FileDocCategorySizeDatePackage
TwoButtons.javaAPI DocExample1954Sat Jan 08 12:06:56 GMT 2005None

TwoButtons

public class TwoButtons extends Object

Fields Summary
JFrame
frame
JLabel
label
Constructors Summary
Methods Summary
public voidgo()

       frame = new JFrame();
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       JButton labelButton = new JButton("Change Label");
       labelButton.addActionListener(new LabelButtonListener());

       JButton colorButton = new JButton("Change Circle");
       colorButton.addActionListener(new ColorButtonListener());

       label = new JLabel("I'm a label");       
       MyDrawPanel drawPanel = new MyDrawPanel();
       
       frame.getContentPane().add(BorderLayout.SOUTH, colorButton);
       frame.getContentPane().add(BorderLayout.CENTER, drawPanel);
       frame.getContentPane().add(BorderLayout.EAST, labelButton);
       frame.getContentPane().add(BorderLayout.WEST, label);

       frame.setSize(420,300);
       frame.setVisible(true);
    
public static voidmain(java.lang.String[] args)

       TwoButtons gui = new TwoButtons();
       gui.go();