acm.io
Class IOConsole

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by acm.io.IOConsole
All Implemented Interfaces:
IOModel, ImageObserver, MenuContainer, Serializable

public class IOConsole
extends Container
implements IOModel

The IOConsole class makes it easier to interact with the user using text-based input and output in the style of a traditional console. Given a IOConsole object, you can write output to that console using the print and println methods, just as you would for the standard output stream. To request input from the user, the most common methods are

A IOConsole object is a lightweight component and must be added to an installed Frame or JFrame before it becomes visible on the screen. The usual strategy for including a console in a frame is to use the ConsoleProgram mechanism in the acm.program package. The operation of the IOConsole class is illustrated by the following test method, which generates the session shown on the right. The user input appears in blue, just as it does in the console window.


      public void test(IOConsole console) {
         console.println("IOConsole class test");
         int n = console.readInt("Enter an integer: ");
         console.println("That integer was " + n);
         double d = console.readDouble("Enter a real number: ");
         console.println("That number was " + d);
         boolean b = console.readBoolean("Enter a boolean value: ");
         console.println("That value was " + b);
         String line = console.readLine("Enter a line: ");
         console.println("That line was \"" + line + "\"");
      }
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static Font DEFAULT_FONT
          The default font used by a new IOConsole.
protected static String LINE_SEPARATOR
          The end-of-line separator for this platform.
protected static int MINIMUM_CONSOLE_HEIGHT
          The minimum height for a console.
protected static int MINIMUM_CONSOLE_WIDTH
          The minimum width for a console.
static IOConsole SYSTEM_CONSOLE
          This constant is an object that offers the functionality of the IOConsole class, but which does so using the standard I/O streams System.in and System.out.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IOConsole()
          Creates a new IOConsole object.
 
Method Summary
 void clear()
          Clears the console display.
 void copy()
          Implements the "Copy" menu operation.
protected  acm.io.ConsoleModel createConsoleModel()
          Creates the console model used by this console.
 void cut()
          Implements the "Cut" menu operation.
 Color getErrorColor()
          Returns the color currently in use for console error messages.
 int getErrorStyle()
          Returns the current style parameters for console error messages.
 boolean getExceptionOnError()
          Returns the state of the error-handling flag.
 Color getInputColor()
          Returns the color currently in use for console input.
 BufferedReader getInputScript()
          Retrieves the input script.
 int getInputStyle()
          Returns the current style parameters for console input.
 ProgramMenuBar getMenuBar()
          Returns the menu bar that controls this console.
 Dimension getMinimumSize()
          Overrides the getMinimumSize method to ensure that an IOConsole is not too large.
 Dimension getPreferredSize()
          Overrides the getPreferredSize method to ensure that an IOConsole is not too large.
 BufferedReader getReader()
          Returns a BufferedReader object that can be used to read from the console.
 PrintWriter getWriter()
          Returns a PrintWriter object that can be used to send output to the console.
 boolean isConsoleMenuItem(JMenuItem item)
          Returns true if the item is one that the console recognizes.
 boolean menuAction(ActionEvent e)
          Called whenever a relevant action is detected in the menu bar.
 void paste()
          Implements the "Paste" menu operation.
 void print(boolean x)
          Makes sure that print can display a boolean.
 void print(char x)
          Makes sure that print can display a char.
 void print(double x)
          Makes sure that print can display a double.
 void print(float x)
          Makes sure that print can display a float.
 void print(int x)
          Makes sure that print can display an int.
 void print(long x)
          Makes sure that print can display a long.
 void print(Object x)
          Makes sure that print can display an Object.
 void print(String value)
          Displays the argument value on the console, leaving the cursor at the end of the output.
 void printConsole()
          Implements the "Print Console" menu operation.
 void printConsole(PrintJob pj)
          Prints the console output using the specified PrintJob object.
 void println()
          Advances the console cursor to the beginning of the next line.
 void println(boolean x)
          Makes sure that println can display a boolean.
 void println(char x)
          Makes sure that println can display a char.
 void println(double x)
          Makes sure that println can display a double.
 void println(float x)
          Makes sure that println can display a float.
 void println(int x)
          Makes sure that println can display an int.
 void println(long x)
          Makes sure that println can display a long.
 void println(Object x)
          Makes sure that println can display an Object.
 void println(String value)
          Displays the argument value on the console and then advances the cursor to the beginning of the next line.
 boolean readBoolean()
          Reads and returns a boolean value from the user, which must match either true or false, ignoring case.
 boolean readBoolean(String prompt)
          Prompts the user to enter a boolean value, which is then returned as the value of this method.
 boolean readBoolean(String prompt, String trueLabel, String falseLabel)
          Prompts the user to enter a value, which is interpreted as a boolean value by matching it against the trueLabel and falseLabel parameters.
 double readDouble()
          Reads and returns a double-precision value from the user.
 double readDouble(double low, double high)
          Reads and returns a double-precision value from the user, which is constrained to be within the specified inclusive range.
 double readDouble(String prompt)
          Prompts the user to enter an double-precision number, which is then returned as the value of this method.
 double readDouble(String prompt, double low, double high)
          Prompts the user to enter an double-precision number, which is then returned as the value of this method.
 int readInt()
          Reads and returns an integer value from the user.
 int readInt(int low, int high)
          Reads and returns an integer value from the user, which is constrained to be within the specified inclusive range.
 int readInt(String prompt)
          Prompts the user to enter an integer, which is then returned as the value of this method.
 int readInt(String prompt, int low, int high)
          Prompts the user to enter an integer, which is then returned as the value of this method.
 String readLine()
          Reads and returns a line of input from the console, without including the end-of-line characters that terminate the input.
 String readLine(String prompt)
          Prompts the user to enter a line of text, which is then returned as the value of this method.
 void requestFocus()
          Overrides the requestFocus method so that it forwards to the console model.
 void save()
          Implements the "Save" menu operation.
 void save(Writer wr)
          Copies the console output to the specified writer.
 void saveAs()
          Implements the "Save As" menu operation.
 void script()
          Implements the "Script" menu operation.
 void selectAll()
          Implements the "Select All" menu operation.
 void setBackground(Color color)
          Sets the background color used for the console.
 void setErrorColor(Color color)
          Sets the color used for console error messages.
 void setErrorStyle(int style)
          Sets the style parameters for console error messages.
 void setExceptionOnError(boolean flag)
          Sets the error-handling mode of the console as specified by the flag parameter.
 void setFont(Font font)
          Sets the font for the console.
 void setFont(String str)
          Sets the font used for the console as specified by the string str, which is interpreted in the style of Font.decode.
 void setForeground(Color color)
          Sets the foreground color used for the output text.
 void setInputColor(Color color)
          Sets the color used for console input.
 void setInputScript(BufferedReader rd)
          Sets a new input script for the console, which will subsequently take input from the specified reader.
 void setInputStyle(int style)
          Sets the style parameters for console input.
 void setMenuBar(ProgramMenuBar mbar)
          Sets the menu bar that controls this console.
 void showErrorMessage(String msg)
          Displays the error message on the console.
 void updateMenuBar(ProgramMenuBar mbar)
          Updates the menu bar to enable the appropriate menu items.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FONT

protected static final Font DEFAULT_FONT
The default font used by a new IOConsole.


LINE_SEPARATOR

protected static final String LINE_SEPARATOR
The end-of-line separator for this platform.


MINIMUM_CONSOLE_HEIGHT

protected static final int MINIMUM_CONSOLE_HEIGHT
The minimum height for a console.

See Also:
Constant Field Values

MINIMUM_CONSOLE_WIDTH

protected static final int MINIMUM_CONSOLE_WIDTH
The minimum width for a console.

See Also:
Constant Field Values

SYSTEM_CONSOLE

public static final IOConsole SYSTEM_CONSOLE
This constant is an object that offers the functionality of the IOConsole class, but which does so using the standard I/O streams System.in and System.out.

Constructor Detail

IOConsole

public IOConsole()
Creates a new IOConsole object.

Method Detail

clear

public void clear()
Clears the console display.


copy

public void copy()
Implements the "Copy" menu operation.


createConsoleModel

protected acm.io.ConsoleModel createConsoleModel()
Creates the console model used by this console.


cut

public void cut()
Implements the "Cut" menu operation.


getErrorColor

public Color getErrorColor()
Returns the color currently in use for console error messages.

Returns:
The current error message color

getErrorStyle

public int getErrorStyle()
Returns the current style parameters for console error messages.

Returns:
The current error message style

getExceptionOnError

public boolean getExceptionOnError()
Returns the state of the error-handling flag.

Returns:
The current setting of the error-handling mode (false to retry on errors; true to raise an exception)

getInputColor

public Color getInputColor()
Returns the color currently in use for console input.

Returns:
The current input color

getInputScript

public BufferedReader getInputScript()
Retrieves the input script. After the end of the input script has been reached, this method will return null.

Returns:
The reader representing the current input script

getInputStyle

public int getInputStyle()
Returns the current style parameters for console input.

Returns:
The current input style

getMenuBar

public ProgramMenuBar getMenuBar()
Returns the menu bar that controls this console.

Returns:
The menu bar

getMinimumSize

public Dimension getMinimumSize()
Overrides the getMinimumSize method to ensure that an IOConsole is not too large.

Overrides:
getMinimumSize in class Container

getPreferredSize

public Dimension getPreferredSize()
Overrides the getPreferredSize method to ensure that an IOConsole is not too large.

Overrides:
getPreferredSize in class Container

getReader

public BufferedReader getReader()
Returns a BufferedReader object that can be used to read from the console.

Returns:
A BufferedReader that reads from this console

getWriter

public PrintWriter getWriter()
Returns a PrintWriter object that can be used to send output to the console.

Returns:
A PrintWriter that writes to this console

isConsoleMenuItem

public boolean isConsoleMenuItem(JMenuItem item)
Returns true if the item is one that the console recognizes.


menuAction

public boolean menuAction(ActionEvent e)
Called whenever a relevant action is detected in the menu bar. Subclasses can override this method to extend the set of menu commands recognized by the console.


paste

public void paste()
Implements the "Paste" menu operation.


print

public final void print(boolean x)
Makes sure that print can display a boolean.

Specified by:
print in interface IOModel

print

public final void print(char x)
Makes sure that print can display a char.

Specified by:
print in interface IOModel

print

public final void print(double x)
Makes sure that print can display a double.

Specified by:
print in interface IOModel

print

public final void print(float x)
Makes sure that print can display a float.

Specified by:
print in interface IOModel

print

public final void print(int x)
Makes sure that print can display an int.

Specified by:
print in interface IOModel

print

public final void print(long x)
Makes sure that print can display a long.

Specified by:
print in interface IOModel

print

public final void print(Object x)
Makes sure that print can display an Object.

Specified by:
print in interface IOModel

print

public void print(String value)
Displays the argument value on the console, leaving the cursor at the end of the output. The print method is overloaded so that value can be of any type.

Specified by:
print in interface IOModel
Parameters:
value - The value to be displayed

printConsole

public void printConsole()
Implements the "Print Console" menu operation.


printConsole

public void printConsole(PrintJob pj)
Prints the console output using the specified PrintJob object. This method is usually invoked from the Print menu item in the ProgramMenuBar class and is not ordinarily called by clients.

Parameters:
pj - PrintJob object to which the output is sent

println

public void println()
Advances the console cursor to the beginning of the next line.

Specified by:
println in interface IOModel

println

public final void println(boolean x)
Makes sure that println can display a boolean.

Specified by:
println in interface IOModel

println

public final void println(char x)
Makes sure that println can display a char.

Specified by:
println in interface IOModel

println

public final void println(double x)
Makes sure that println can display a double.

Specified by:
println in interface IOModel

println

public final void println(float x)
Makes sure that println can display a float.

Specified by:
println in interface IOModel

println

public final void println(int x)
Makes sure that println can display an int.

Specified by:
println in interface IOModel

println

public final void println(long x)
Makes sure that println can display a long.

Specified by:
println in interface IOModel

println

public final void println(Object x)
Makes sure that println can display an Object.

Specified by:
println in interface IOModel

println

public void println(String value)
Displays the argument value on the console and then advances the cursor to the beginning of the next line. The println method is overloaded so that value can be of any type.

Specified by:
println in interface IOModel
Parameters:
value - The value to be displayed

readBoolean

public final boolean readBoolean()
Reads and returns a boolean value from the user, which must match either true or false, ignoring case. If the user types a value that is not one of these possibilities, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readBoolean in interface IOModel
Returns:
The value of the input interpreted as a boolean value

readBoolean

public final boolean readBoolean(String prompt)
Prompts the user to enter a boolean value, which is then returned as the value of this method. If the user types a value that is not a legal boolean value, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readBoolean in interface IOModel
Parameters:
prompt - The prompt string to display to the user
Returns:
The value of the input interpreted as a boolean value

readBoolean

public boolean readBoolean(String prompt,
                           String trueLabel,
                           String falseLabel)
Prompts the user to enter a value, which is interpreted as a boolean value by matching it against the trueLabel and falseLabel parameters. If the user types a value that is not one of the two choices, readBoolean ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readBoolean in interface IOModel
Parameters:
prompt - The prompt string to display to the user
trueLabel - The string used to indicate true
falseLabel - The string used to indicate false
Returns:
The value of the input interpreted as a boolean value

readDouble

public final double readDouble()
Reads and returns a double-precision value from the user. If the user types a value that is not a legal number, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readDouble in interface IOModel
Returns:
The value of the input interpreted as a double

readDouble

public final double readDouble(double low,
                               double high)
Reads and returns a double-precision value from the user, which is constrained to be within the specified inclusive range. If the user types a value that is not a legal number, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readDouble in interface IOModel
Parameters:
low - The lowest value in the permitted range
high - The highest value in the permitted range
Returns:
The value of the input interpreted as a double

readDouble

public final double readDouble(String prompt)
Prompts the user to enter an double-precision number, which is then returned as the value of this method. If the user types a value that is not a legal number, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readDouble in interface IOModel
Parameters:
prompt - The prompt string to display to the user
Returns:
The value of the input interpreted as a double

readDouble

public double readDouble(String prompt,
                         double low,
                         double high)
Prompts the user to enter an double-precision number, which is then returned as the value of this method. The value must be within the inclusive range between low and high. If the user types a value that is not a legal number, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readDouble in interface IOModel
Parameters:
prompt - The prompt string to display to the user
low - The lowest value in the permitted range
high - The highest value in the permitted range
Returns:
The value of the input interpreted as a double

readInt

public final int readInt()
Reads and returns an integer value from the user. If the user types a value that is not a legal integer, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readInt in interface IOModel
Returns:
The value of the input interpreted as a decimal integer

readInt

public final int readInt(int low,
                         int high)
Reads and returns an integer value from the user, which is constrained to be within the specified inclusive range. If the user types a value that is not a legal integer, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readInt in interface IOModel
Parameters:
low - The lowest value in the permitted range
high - The highest value in the permitted range
Returns:
The value of the input interpreted as a decimal integer

readInt

public final int readInt(String prompt)
Prompts the user to enter an integer, which is then returned as the value of this method. If the user types a value that is not a legal integer, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readInt in interface IOModel
Parameters:
prompt - The prompt string to display to the user
Returns:
The value of the input interpreted as a decimal integer

readInt

public int readInt(String prompt,
                   int low,
                   int high)
Prompts the user to enter an integer, which is then returned as the value of this method. The value must be within the inclusive range between low and high. If the user types a value that is not a legal integer or is outside the specified range, the method ordinarily offers the user a chance to reenter the data, although this behavior can be changed using the setExceptionOnError method.

Specified by:
readInt in interface IOModel
Parameters:
prompt - The prompt string to display to the user
low - The lowest value in the permitted range
high - The highest value in the permitted range
Returns:
The value of the input interpreted as a decimal integer

readLine

public final String readLine()
Reads and returns a line of input from the console, without including the end-of-line characters that terminate the input.

Specified by:
readLine in interface IOModel
Returns:
The next line of input as a String

readLine

public String readLine(String prompt)
Prompts the user to enter a line of text, which is then returned as the value of this method. The end-of-line characters that terminate the input are not included in the returned string.

Specified by:
readLine in interface IOModel
Parameters:
prompt - The prompt string to display to the user
Returns:
The next line of input as a String

requestFocus

public void requestFocus()
Overrides the requestFocus method so that it forwards to the console model.

Overrides:
requestFocus in class Component

save

public void save()
Implements the "Save" menu operation.


save

public void save(Writer wr)
Copies the console output to the specified writer.

Parameters:
wr - A Writer to which the console output is sent

saveAs

public void saveAs()
Implements the "Save As" menu operation.


script

public void script()
Implements the "Script" menu operation.


selectAll

public void selectAll()
Implements the "Select All" menu operation.


setBackground

public void setBackground(Color color)
Sets the background color used for the console.

Overrides:
setBackground in class Component
Parameters:
color - The new background color

setErrorColor

public void setErrorColor(Color color)
Sets the color used for console error messages.

Parameters:
color - The color used for console error messages

setErrorStyle

public void setErrorStyle(int style)
Sets the style parameters for console error messages. The style parameter is either Font.PLAIN or a sum of one or more of the attributes Font.BOLD and Font.ITALIC.

Parameters:
style - The style attributes to be used for console error messages

setExceptionOnError

public void setExceptionOnError(boolean flag)
Sets the error-handling mode of the console as specified by the flag parameter. If flag is false (which is the default), the input methods give the user a chance to retry after erroneous input. If this value is set to true, illegal input raises an ErrorException instead.

Parameters:
flag - false to retry on errors; true to raise an exception

setFont

public void setFont(Font font)
Sets the font for the console.

Overrides:
setFont in class Container
Parameters:
font - The font to use for the console

setFont

public void setFont(String str)
Sets the font used for the console as specified by the string str, which is interpreted in the style of Font.decode. The usual format of the font string is

family-style-size

where both style and size are optional. If any of these parts are specified as an asterisk, the existing value is retained.

Parameters:
str - A String specifying the new font

setForeground

public void setForeground(Color color)
Sets the foreground color used for the output text.

Overrides:
setForeground in class Component
Parameters:
color - The color to use for the output text

setInputColor

public void setInputColor(Color color)
Sets the color used for console input.

Parameters:
color - The color used for console input

setInputScript

public void setInputScript(BufferedReader rd)
Sets a new input script for the console, which will subsequently take input from the specified reader. When the input from the reader has been exhausted, the console returns to its normal operation. This method is primarily useful for demonstrations and test suites, and is not ordinarily invoked by students.

Parameters:
rd - The reader from which console input is taken

setInputStyle

public void setInputStyle(int style)
Sets the style parameters for console input. The style parameter is either Font.PLAIN or a sum of one or more of the attributes Font.BOLD and Font.ITALIC.

Parameters:
style - The style attributes to be used for console input

setMenuBar

public void setMenuBar(ProgramMenuBar mbar)
Sets the menu bar that controls this console.

Parameters:
mbar - The menu bar

showErrorMessage

public void showErrorMessage(String msg)
Displays the error message on the console.

Specified by:
showErrorMessage in interface IOModel
Parameters:
msg - The error msg to be displayed

updateMenuBar

public void updateMenuBar(ProgramMenuBar mbar)
Updates the menu bar to enable the appropriate menu items.