FileDocCategorySizeDatePackage
Colours2.javaAPI DocExample1343Thu Feb 03 08:18:02 GMT 2000None

Colours2

public class Colours2 extends Frame

Fields Summary
Constructors Summary
public Colours2()

  setTitle( "Colours2" );
      setSize ( 200, 200 );
      setLayout( new FlowLayout() );
      Button red = new Button( "Red" );
      red.setBackground( Color.white );
      red.setForeground( Color.black );  
      Button blue = new Button( "Blue" );
      blue.setBackground( Color.white );
      blue.setForeground( Color.black );  
      add( red );
      add( blue );
      
      red.addActionListener( new ActionListener() {
         public void actionPerformed( ActionEvent e )
         {  setBackground( Color.red );
            repaint();
         }
      });
      
      blue.addActionListener( new ActionListener() {
         public void actionPerformed( ActionEvent e )
         {  setBackground( Color.blue );
            repaint();
         }
      });
         
      addWindowListener( new WindowAdapter() {
         public void windowClosing( WindowEvent e )
         {  System.exit(0);
         }
      }); 
      
      setVisible( true );
   
Methods Summary
public static voidmain(java.lang.String[] args)

  new Colours2();