Hello
I am new to java and got stock in this GUI.
I need to get this :
http://occ.ucompass.com/educator/com...anelLayout.png
I am half way done this my code so far.
Code:import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.GridBagLayout;
//import javax.swing.JPanel;
public class GUIQuestion extends JFrame
{
JCheckBox b1 = new JCheckBox("one", false);
JCheckBox b2 = new JCheckBox("two", false);
JCheckBox b3 = new JCheckBox("three", true);
JCheckBox b4 = new JCheckBox("four", false);
JButton ok = new JButton("OK");
JTextField tf = new JTextField("sample");
public static void main(String [] args)
{
GUIQuestion gq = new GUIQuestion();
}
public GUIQuestion()
{
super("GUI Question");
setLayout(new FlowLayout());
setLayout(new GridLayout(3,3));
JPanel b1panel = new JPanel();////income panel and text field
JPanel b2panel = new JPanel();
JPanel b3panel = new JPanel();
JPanel b4panel = new JPanel();
JPanel okpanel = new JPanel();//(new FlowLayout(FlowLayout.RIGHT));
JPanel tfpanel = new JPanel();
//add checkbox to the panels
b1panel.add(b1);
b2panel.add(b3);
b2panel.add(b2);
b2panel.add(b4);
okpanel.add(ok);
//okpanel.setLayout(new FlowLayout(FlowLayout.NORTH));
okpanel.setAlignmentX(Component.LEFT_ALIGNMENT);
tfpanel.add(tf);
tfpanel.setLayout(new FlowLayout(FlowLayout.LEFT));
//add the panel to the content panel
add(b1panel);
add(b3panel);
add(b2panel);
add(b4panel);
add(okpanel);
add(tfpanel);
pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

