How to put 2 containers into 1 container in java?

ساخت وبلاگ

Vote count: 0

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"); }
asked 1 min ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 188 تاريخ : شنبه 1 خرداد 1395 ساعت: 12:28