ConsoleApplet - /* The ConsoleApplet provides a basis for...

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

View Full Document Right Arrow Icon
/* The ConsoleApplet provides a basis for writing applets that simulate line-oriented console-type input/output. The class ConsoleCanvas is used to provide the I/O routines; these routines type output into the ConsoleCanvas and read input typed there by the user. See the files CanvasPanel.java and ConsoleCanvas.java for information. A console applet is set up to run one particular program. The applet includes a button that the user presses to run the program (or to abort it when it is running). It also includes a label, which by default is "Java I/O Console". The default program, defined in this file, is a simple Hello World program. To write a new console applet, with a more interesting program, you should create a subclass of ConsoleApplet. The subclass should override the method program() , which represents the program to be run. The program should use the instance variable, console, to do input/output. For example, console.putln("HelloWorld.") or N=console.getInt(). All the public methods of class ConsolePanel can be called in the program. (Of course, you could also just modify this file, instead of
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 / 3

ConsoleApplet - /* The ConsoleApplet provides a basis for...

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