ESTA ES LA PRIMERA PARTE DEL CODIGO
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.GridBagLayout;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JTextField;
import java.awt.Insets;
import java.awt.FlowLayout;
import java.awt.Color;
import java.awt.Font;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class trabajofinal extends JFrame
{
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel PanelSur = null;
private JButton Button1 = null;
private JButton Button2 = null;
private JPanel PanelEste = null;
private JLabel Label1 = null;
private JLabel Label2 = null;
private JLabel Label3 = null;
private JLabel Label4 = null;
private JLabel Label5 = null;
private JLabel Label6 = null;
private JPanel PanelOeste = null;
private JTextField TextField1 = null;
private JTextField TextField2 = null;
private JTextField TextField3 = null;
private JTextField TextField4 = null;
private JTextField TextField5 = null;
private JTextField TextField6 = null;
private JPanel getPanelSur()
{
if (PanelSur == null)
{
PanelSur = new JPanel();
PanelSur.setLayout(new FlowLayout());
PanelSur.setPreferredSize(new Dimension(50, 50));
PanelSur.setBackground(new Color(242, 219, 219));
PanelSur.add(getButton1(), null);
PanelSur.add(getButton2(), null);
}
return PanelSur;
}
private JButton getButton1()
{
if (Button1 == null)
{
Button1 = new JButton();
Button1.setText("ANTERIOR");
Button1.setBackground(new Color(242, 219, 219));
Button1.setPreferredSize(new Dimension(94, 35));
Button1.setHorizontalTextPosition(SwingConstants.C ENTER);
}
return Button1;
}
private JButton getButton2()
{
if (Button2 == null)
{
Button2 = new JButton();
Button2.setText("SIGUIENTE");
Button2.setPreferredSize(new Dimension(94, 35));
Button2.setBackground(new Color(242, 219, 219));
}
return Button2;
}
private JPanel getPanelEste()
{
if (PanelEste == null)
{
GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
gridBagConstraints7.insets = new Insets(0, 35, 25, 15);
gridBagConstraints7.gridy = 5;
gridBagConstraints7.ipadx = 50;
gridBagConstraints7.gridx = 0;
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.insets = new Insets(0, 35, 0, 15);
gridBagConstraints6.gridy = 4;
gridBagConstraints6.ipadx = 50;
gridBagConstraints6.gridx = 0;
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.insets = new Insets(0, 35, 0, 15);
gridBagConstraints5.gridy = 3;
gridBagConstraints5.ipadx = 50;
gridBagConstraints5.gridx = 0;
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.insets = new Insets(0, 35, 0, 15);
gridBagConstraints4.gridy = 2;
gridBagConstraints4.ipadx = 50;
gridBagConstraints4.gridx = 0;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.insets = new Insets(0, 35, 0, 15);
gridBagConstraints3.gridy = 1;
gridBagConstraints3.ipadx = 50;
gridBagConstraints3.gridx = 0;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.insets = new Insets(24, 35, 0, 15);
gridBagConstraints2.gridy = 0;
gridBagConstraints2.ipadx = 50;
gridBagConstraints2.gridx = 0;
Label6 = new JLabel();
Label6.setText("TELÉFONO: ");
Label6.setHorizontalAlignment(SwingConstants.CENTE R);
Label6.setHorizontalTextPosition(SwingConstants.CE NTER);
Label6.setPreferredSize(new Dimension(80, 25));
Label5 = new JLabel();
Label5.setText("E-MAIL: ");
Label5.setHorizontalTextPosition(SwingConstants.CE NTER);
Label5.setHorizontalAlignment(SwingConstants.CENTE R);
Label5.setPreferredSize(new Dimension(80, 25));
Label4 = new JLabel();
Label4.setText("DIRECCIÓN : ");
Label4.setHorizontalAlignment(SwingConstants.CENTE R);
Label4.setHorizontalTextPosition(SwingConstants.CE NTER);
Label4.setPreferredSize(new Dimension(80, 25));
Label3 = new JLabel();
Label3.setText("APELLIDO: ");
Label3.setHorizontalTextPosition(SwingConstants.CE NTER);
Label3.setPreferredSize(new Dimension(80, 25));
Label3.setHorizontalAlignment(SwingConstants.CENTE R);
Label2 = new JLabel();
Label2.setText("NOMBRE: ");
Label2.setHorizontalAlignment(SwingConstants.CENTE R);
Label2.setHorizontalTextPosition(SwingConstants.CE NTER);
Label2.setForeground(Color.black);
Label2.setPreferredSize(new Dimension(80, 25));
Label1 = new JLabel();
Label1.setText("NRO_CEDULA: ");
Label1.setHorizontalTextPosition(SwingConstants.CE NTER);
Label1.setHorizontalAlignment(SwingConstants.CENTE R);
Label1.setFont(new Font("Dialog", Font.BOLD, 12));
Label1.setForeground(Color.black);
Label1.setPreferredSize(new Dimension(80, 25));
PanelEste = new JPanel();
PanelEste.setLayout(new GridBagLayout());
PanelEste.setPreferredSize(new Dimension(180, 50));
PanelEste.setBackground(new Color(242, 219, 219));
PanelEste.add(Label1, gridBagConstraints2);
PanelEste.add(Label2, gridBagConstraints3);
PanelEste.add(Label3, gridBagConstraints4);
PanelEste.add(Label4, gridBagConstraints5);
PanelEste.add(Label5, gridBagConstraints6);
PanelEste.add(Label6, gridBagConstraints7);
}
return PanelEste;
}
public JPanel getPanelOeste()
{
if (PanelOeste == null)
{
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.fill = GridBagConstraints.VERTICAL;
gridBagConstraints13.gridx = 0;
gridBagConstraints13.gridy = 5;
gridBagConstraints13.weightx = 1.0;
gridBagConstraints13.insets = new Insets(0, 5, 25, 5);
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.fill = GridBagConstraints.VERTICAL;
gridBagConstraints12.gridx = 0;
gridBagConstraints12.gridy = 4;
gridBagConstraints12.weightx = 1.0;
gridBagConstraints12.insets = new Insets(0, 5, 0, 5);
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = GridBagConstraints.VERTICAL;
gridBagConstraints11.gridx = 0;
gridBagConstraints11.gridy = 3;
gridBagConstraints11.weightx = 1.0;
gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.fill = GridBagConstraints.VERTICAL;
gridBagConstraints10.gridx = 0;
gridBagConstraints10.gridy = 2;
gridBagConstraints10.weightx = 1.0;
gridBagConstraints10.insets = new Insets(0, 5, 0, 5);
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
gridBagConstraints9.fill = GridBagConstraints.VERTICAL;
gridBagConstraints9.gridx = 0;
gridBagConstraints9.gridy = 1;
gridBagConstraints9.weightx = 1.0;
gridBagConstraints9.insets = new Insets(0, 5, 0, 5);
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
gridBagConstraints8.fill = GridBagConstraints.VERTICAL;
gridBagConstraints8.gridx = 0;
gridBagConstraints8.gridy = 0;
gridBagConstraints8.weightx = 1.0;
gridBagConstraints8.insets = new Insets(24, 5, 0, 5);
PanelOeste = new JPanel();
PanelOeste.setLayout(new GridBagLayout());
PanelOeste.setPreferredSize(new Dimension(312, 0));
PanelOeste.setBackground(new Color(242, 219, 219));
PanelOeste.add(getTextField1(), gridBagConstraints8);
PanelOeste.add(getTextField2(), gridBagConstraints9);
PanelOeste.add(getTextField3(), gridBagConstraints10);
PanelOeste.add(getTextField4(), gridBagConstraints11);
PanelOeste.add(getTextField5(), gridBagConstraints12);
PanelOeste.add(getTextField6(), gridBagConstraints13);
}
return PanelOeste;
}
private JTextField getTextField1()
{
if (TextField1 == null)
{
TextField1 = new JTextField();
TextField1.setPreferredSize(new Dimension(290, 25));
}
return TextField1;
}
private JTextField getTextField2()
{
if (TextField2 == null)
{
TextField2 = new JTextField();
TextField2.setPreferredSize(new Dimension(290, 25));
}
return TextField2;
}
private JTextField getTextField3()
{
if (TextField3 == null)
{
TextField3 = new JTextField();
TextField3.setPreferredSize(new Dimension(290, 25));
}
return TextField3;
}
private JTextField getTextField4()
{
if (TextField4 == null)
{
TextField4 = new JTextField();
TextField4.setPreferredSize(new Dimension(290, 25));
}
return TextField4;
}
private JTextField getTextField5()
{
if (TextField5 == null)
{
TextField5 = new JTextField();
TextField5.setPreferredSize(new Dimension(290, 25));
}
return TextField5;
}
private JTextField getTextField6()
{
if (TextField6 == null)
{
TextField6 = new JTextField();
TextField6.setPreferredSize(new Dimension(290, 25));
}
return TextField6;
}
public trabajofinal()
{
super();
initialize();
}
private void initialize()
{
this.setSize(499, 283);
this.setContentPane(getJContentPane());
this.setTitle("TRABAJO PRÁCTICO - VENTANA CON DATOS POSTGRE");
this.setVisible(true);
}