Ver Mensaje Individual
  #5 (permalink)  
Antiguo 22/06/2018, 02:26
TrinityCore
 
Fecha de Ingreso: agosto-2015
Ubicación: Rosario - Argentina
Mensajes: 424
Antigüedad: 8 años, 8 meses
Puntos: 12
Respuesta: GridBagLayout - Dudas

Asi, pero no hay resultados... no me esta dejando espacios para nada.
Código Java:
Ver original
  1. public class ConnectionData extends JPanel{
  2.  
  3.     private GridBagConstraints gbc;
  4.     private JLabel LB_1, LB_2;
  5.     private JTextField TEXT_1, TEXT_2;
  6.  
  7.     public ConnectionData(){
  8.    
  9.         this.gbc = new GridBagConstraints();
  10.         GridBagLayout gbl = new GridBagLayout();
  11.         this.setLayout(gbl);
  12.        
  13.         this.LB_1 = new JLabel("LB_1");
  14.         this.LB_2 = new JLabel("LB_2:");
  15.         this.TEXT_1 = new JTextField(10);
  16.         this.TEXT_2 = new JTextField(6);
  17.        
  18.         gbc.gridwidth = 1;
  19.         gbc.gridheight = 1;
  20.         gbc.gridx = 0;
  21.         gbc.gridy = 0;
  22.         this.add(LB_1, gbc);
  23.        
  24.         gbc.gridwidth = 1;
  25.         gbc.gridheight = 1;
  26.         gbc.gridx = 2;
  27.         gbc.gridy = 0;
  28.         this.add(TEXT_1, gbc);
  29.        
  30.         gbc.gridwidth = 1;
  31.         gbc.gridheight = 1;
  32.         gbc.gridx = 6;
  33.         gbc.gridy = 0;
  34.         this.add(LB_2, gbc);
  35.        
  36.         gbc.gridwidth = 1;
  37.         gbc.gridheight = 1;
  38.         gbc.gridx = 8;
  39.         gbc.gridy = 0;
  40.         this.add(TEXT_2, gbc);
  41.        
  42.     }
  43. }