Basic HTML version of Foils prepared Sept 21 1998

Foil 32 Basic AWT Component: Button

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

Buttons for Foil 32
A Button is the familiar way to allow a user to cause an event and is created with a String to label it
  • Button button1 = new Button("Click here");
  • add (button1);
Buttons are normally created to appear in the style of the user's windowing system, except that you can control the color of the button and the String
  • button1.setBackground (Color.cyan);
  • button1.setForeground (Color.black);
Click here



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998