My class has 4 parts of textfields, 1 on the top, 1 on the left, 2 on the right. As I am using containers, so I think I need to put those 2 together under 1 big container so that I can set it's location in "East", but I'm not sure how...
private void display1(Container container){ JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); panel.setLayout(new GridLayout(1,1)); display1 = new JTextField("testing"); constraint.gridx = 4; constraint.gridy = 0; panel.add(displaytrain, constraint); container.add(panel); } private void display2(Container container){ JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); panel.setLayout(new GridLayout(1,1)); display2 = new JTextField("testing"); constraint.gridx = 4; constraint.gridy = 0; panel.add(displaytrain, constraint); container.add(panel); } private void bigDisplay(Container container){ JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); //putting the dispay1 and display2 here...? container.add(panel, "East"); }