FileDocCategorySizeDatePackage
RedTown.javaAPI DocExample977Mon Apr 05 10:09:16 BST 1999None

RedTown

public class RedTown extends JFrame

Fields Summary
Constructors Summary
public RedTown()

    super("RedTown v1.0");
    createUI();
    setVisible(true);
  
Methods Summary
protected voidcreateUI()

    setSize(400, 400);
    setLocation(100, 100);
    getContentPane().setLayout(new GridBagLayout());
    JButton colorButton = new JButton("Choose a color...");
    getContentPane().add(colorButton);
    colorButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        Color c = JColorChooser.showDialog(
            RedTown.this, "Choose a color...", getBackground());
        if (c != null) getContentPane().setBackground(c);
      }
    });
    
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent we) {
        System.exit(0);
      }
    });
  
public static voidmain(java.lang.String[] args)

    new RedTown();