Toggle your browser's Back and Forward buttons to compare the running applet to this code. |
Click here to run a fresh copy of the applet: SimpleApplet8.html |
/** USE EXISTING JAVA CLASSES **/
import java.awt.*;
import java.applet.Applet;
/** EXTEND THE JAVA APPLET CLASS **/
public class SimpleApplet8 extends Applet
{Button redButton,blueButton,greenButton,
whiteButton,blackButton;
// Declare the buttons, and
Font font = new Font("TimesRoman",Font.BOLD,20);
// define the font for the
// window text.
public void init()
// Change the gray background
{setBackground(Color.white);
// to white.
setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
// Define the Layout Manager
// for the arrangement of the
redButton = new Button("Red");
// buttons. Create the labeled
add(redButton);
// buttons, and add them to
blueButton = new Button("Blue");
// the layout.
add(blueButton);
greenButton = new
Button("Green");
add(greenButton);
whiteButton = new
Button("White");
add(whiteButton);
blackButton = new
Button("Black");
add(blackButton);
}
Toggle your browser's Back and Forward buttons to compare the running applet to this code. |
Click here to run a fresh copy of the applet: SimpleApplet8.html |
repaint();
}
Toggle your browser's Back and Forward buttons to compare the running applet to this code. |
Click here to run a fresh copy of the applet: SimpleApplet8.html |