import java.applet.*; import java.awt.*; public class button extends Applet { public void init() { add(new Button("Red")); add(new Button("White")); add(new Button("Blue")); add(new Label("Hit a Button to change the screen color")); } public boolean action(Event evt, Object whatAction) { if (!(evt.target instanceof Button)) { return false; } String buttonLabel = (String) whatAction; if (buttonLabel=="Red") setBackground(Color.red); if (buttonLabel=="White") setBackground(Color.white); if (buttonLabel=="Blue") setBackground(Color.blue); repaint(); return true; } }