BlinkingHelloWorld2

BlinkingHelloWorld2 - An applet that says"Hello World in a big bold font When the user clicks on a button labeled"Blink the message starts cycling

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. When the user // clicks on a button labeled "Blink!", the message starts cycling // between two color. If the user clicks on the button again, the // cycling stops. Two other buttons can be used to select whether the // applet cycles between read and green or between black and blue // This applet depends on the class ColoredHelloWorldCanvas, which // is defined in a separate file. / import java.awt.*; import java.awt.event.*; import java.applet.Applet; i public class BlinkingHelloWorld2 extends Applet implements ActionListener, Runnable { ColoredHelloWorldCanvas canvas; // A canvas which actually displays the message Button blinkBttn; // The control button. Thread runner; // a thread that is responsible for cycling the message colors. private final static int GO = 0, // Constants for use as value of status. TERMINATE = 1; private volatile int status = GO; // This variable is used for communication between // the applet and the thread. The value is set by // the applet to tell the thread what to do. In // particlar, when the applet wants the thread // to terminate, it sets the value of status to // TERMINATE. boolean useRedAndGreen;
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.

This note was uploaded on 01/15/2010 for the course CSC 115 taught by Professor Jackson during the Spring '09 term at University of Victoria.

Page1 / 4

BlinkingHelloWorld2 - An applet that says"Hello World in a big bold font When the user clicks on a button labeled"Blink the message starts cycling

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