BlinkingHelloWorld1

BlinkingHelloWorld1 - / / / / / 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. When the user // clicks on a button labeled "Blink at Me!", the message cycles a few times // from red to green and back. This applet depends on the class // ColoredHellowWorldCanvas, which is defined in a separate file. / import java.awt.*; import java.awt.event.*; import java.applet.Applet; i public class BlinkingHelloWorld1 extends Applet implements ActionListener, Runnable { ColoredHelloWorldCanvas canvas; // A canvas which actually displays the message Button blinkBttn; // The control button. Thread blinker; // a thread that is responsible for cycling the message colors. public void init() { // This routine is called by the system to initilize the applet. // It creates the canvas and lays out the applet to consist of a // bar of control buttons below the canvas. setBackground(Color.lightGray); canvas = new ColoredHelloWorldCanvas(); Panel buttonBar = new Panel(); // a panel to hold the control buttons blinkBttn = new Button("Blink at Me!"); // Create button and add it to the
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 / 2

BlinkingHelloWorld1 - / / / / / 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