ColoredHelloWorldApplet

ColoredHelloWorldApplet - / An applet that says "Hello...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// An applet that says "Hello World" in a big bold font, // with a button to change the color of the message. import java.awt.*; // Defines basic classes for GUI programming. import java.awt.event.*; // Defines classes for working with events. import java.applet.*; // Defines the applet class. public class ColoredHelloWorldApplet extends Applet implements ActionListener { // Defines a subclass of Applet. The "implements ActionListener" // part says that objects of type ColoredHelloApplet are // capable of listening for ActionEvents. This is necessary // if the applet is to respond to events from the button. int colorNum; // Keeps track of which color is displayed; // 1 for red, 2 for blue, 3 for green. Font textFont; // The font in which the message is displayed. // A font object represent a certain size and // style of text drawn on the screen. public void init() { // This routine is called by the system to initialize the applet. // It sets up the font and initial color for the message and
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

ColoredHelloWorldApplet - / An applet that says "Hello...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online