acm.program
Class DialogProgram

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--acm.program.Program
                                      |
                                      +--acm.program.DialogProgram

public abstract class DialogProgram
extends Program

This class is a standard subclass of Program that takes its input from a IODialog object.


 
Constructor Summary
DialogProgram()
Creates a new dialog program.
 
Method Summary
IOModel getInputModel()
Returns the IOModel used for program input.
IOModel getOutputModel()
Returns the IOModel used for program output.
void run()
Contains the code to be executed for each specific program subclass.
 
Inherited Method Summary
IOConsolegetConsole()
Returns the console associated with this program.
IODialoggetDialog()
Returns the dialog used for user interaction.
BufferedReadergetReader()
Returns a BufferedReader whose input comes from the console.
StringgetTitle()
Gets the title of this program.
PrintWritergetWriter()
Returns a PrintWriter whose output is directed to the console.
voidpause(double milliseconds)
Delays the calling thread for the specified time.
voidprint(String value)
Displays the argument value, allowing for the possibility of more output in the same dialog.
voidprintln()
Completes the output line and displays the dialog.
voidprintln(String value)
Adds the value to the current output line and then displays the dialog.
booleanreadBoolean()
Puts up a dialog box asking the user for a true/false value.
booleanreadBoolean(String prompt)
Puts up a dialog box asking the user for a true/false value.
booleanreadBoolean(String prompt, trueLabel, falseLabel)
Puts up a dialog box asking the user for a boolean value chosen from buttons with the specified labels.
doublereadDouble()
Puts up a dialog box asking the user for a double-precision number.
doublereadDouble(String prompt)
Puts up a dialog box asking the user for a double-precision number.
intreadInt()
Puts up a dialog box asking the user for an integer.
intreadInt(String prompt)
Puts up a dialog box asking the user for an integer.
StringreadLine()
Puts up a dialog box asking the user for a line of text.
StringreadLine(String prompt)
Puts up a dialog box asking the user for a line of text.
voidsetTitle(String title)
Sets the title of this program.
 

Constructor Detail

public DialogProgram()

Creates a new dialog program.

 
Usage: DialogProgram program = new DialogProgram(); 
 
Method Detail

public IOModel getInputModel()

Returns the IOModel used for program input.

 
Usage: IOModel io = program.getInputModel(); 
Returns: The IOModel used for program input
 

public IOModel getOutputModel()

Returns the IOModel used for program output.

 
Usage: IOModel io = program.getOutputModel(); 
Returns: The IOModel used for program output
 

public void run()

Contains the code to be executed for each specific program subclass. If you are defining your own DialogProgram class, you need to override the definition of run so that it contains the code for your application.