Basic HTML version of Foils prepared 13 October 97

Foil 32 Basic AWT Component: Button

From Java Tutorial, July 1, 1996 CSC499(JSU) CPS406/606 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox

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);



© 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 Wed Apr 1 1998