Esta es un codigo pero hecho en netBeans y la verdad no me gusta por que es mucho codigo para un formulario con 4 labels y 4 textfield.
Código Java:
Ver originalprivate void initComponents() {
jPanel1
= new javax.
swing.
JPanel(); jLabel1
= new javax.
swing.
JLabel(); jLabel2
= new javax.
swing.
JLabel(); jLabel3
= new javax.
swing.
JLabel(); jLabel4
= new javax.
swing.
JLabel(); jTable2
= new javax.
swing.
JTable(); btnNuevo
= new javax.
swing.
JButton(); btnGuardar
= new javax.
swing.
JButton(); btnModificar
= new javax.
swing.
JButton(); btnEliminar
= new javax.
swing.
JButton(); btnCerrar
= new javax.
swing.
JButton();
jPanel1.
setBorder(javax.
swing.
BorderFactory.
createTitledBorder("Datos clientes")); jPanel1.setToolTipText("");
jLabel1.setText("Nombres:");
jLabel2.setText("Correo:");
jLabel3.setText("Dirección:");
jLabel4.setText("Teléfono:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(33, 33, 33))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(24, 24, 24)))
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(20, 20, 20)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jtxtCorreo)
.
addComponent(jtxtNombres, javax.
swing.
GroupLayout.
DEFAULT_SIZE,
181,
Short.
MAX_VALUE) .addComponent(jtxtDireccion)
.addComponent(jtxtTelefono))
.
addContainerGap(39,
Short.
MAX_VALUE)) );
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jtxtNombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jtxtCorreo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jtxtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jtxtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.
addContainerGap(20,
Short.
MAX_VALUE)) );
}