title: Positioning with Java GroupLayout
body: <p>The below code creates the following GUI.</p>
  
  <p><a href="https://i.stack.imgur.com/ZDKKP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZDKKP.png" alt="IMG"></a>
  </p>
  
  <p>But I would like to have TextFields "A" and "C" completely fill their respective rows (so that their right corners are aligned with the right edge of the JComboBox. Help would be much appreciated!</p>
  
  <p>Here's the code:</p>
  
  <pre><code>JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setResizable(true);
          Dimension size = new Dimension( 310, 210 );
          frame.setSize(size);
          frame.setPreferredSize(size);
  
          JTextField tf1 = new JTextField();
          JTextField tf2 = new JTextField();
          JTextField tf3 = new JTextField();
  
          JLabel label1 = new JLabel( "A");
          JLabel label2 = new JLabel( "B");
          JLabel label3 = new JLabel( "C");
  
          String[] opts = {"1","2","3"};
          JComboBox dropdown = new JComboBox(opts);
          JPanel panel = new JPanel();
  
         GroupLayout layout = new GroupLayout(panel);
         panel.setLayout(layout);
         layout.setAutoCreateGaps(true);
         layout.setAutoCreateContainerGaps(true);
  
         GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
  
         hGroup.addGroup(layout.createParallelGroup().
                  addComponent(label1).addComponent(label2).
                  addComponent(label3));
  
         hGroup.addGroup(layout.createParallelGroup().
                  addComponent(tf1).addComponent(tf2).
                  addComponent(tf3));
  
         hGroup.addGroup(layout.createParallelGroup().addComponent(dropdown));
  
  
         layout.setHorizontalGroup(hGroup);
  
         GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();
  
         vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE).
                  addComponent(label1).addComponent(tf1));
         vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE).
                  addComponent(label2).addComponent(tf2).addComponent(dropdown));  
         vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE).
                 addComponent(label3).addComponent(tf3));
  
         layout.setVerticalGroup(vGroup);
  
         frame.add( panel, BorderLayout.NORTH );
         frame.setVisible(true);
  </code></pre>