I'm supposed to be making a simple GUI program for my CSCI class and I pieced together this, yet it's not running correctly; nothing is opening.
Here is my code:
public class GUIassignment extends JFrame
{
public GUIassignment()
{
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10));
p1.add(new JButton("Button 1"));
p1.add(new JButton("Button 2"));
p1.add(new JButton("Button 3"));
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 10));
p2.add(new JButton("Button 4"));
p2.add(new JButton("Button 5"));
p2.add(new JButton("Button 6"));
Container gui = getContentPane();
gui.add(p1, BorderLayout.NORTH);
gui.add(p2, BorderLayout.SOUTH);
}
public static void main(String[] args)
{
GUIassignment gui = new GUIassignment();
}
}

New Topic/Question
Reply



MultiQuote



|