|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectConsoleParent
abstract class ConsoleParent
Field Summary | |
---|---|
protected static int |
BUFFER_SIZE
|
(package private) ConsoleCanvas |
consoleCanvas
The drawing surface. |
protected Panel |
consoleCanvasPanelInner
|
protected static int |
DEFAULT_COLUMNS
|
protected static int |
DEFAULT_FONT_SIZE
|
protected static int |
DEFAULT_ROWS
|
protected static String |
DEFAULT_TITLE
|
protected static int |
EMPTY_BUFFER
|
protected boolean |
eofReached
|
protected char[] |
kbdBuffer
|
protected int |
kbdBufferHead
|
protected int |
kbdBufferTail
|
protected char[] |
lineBuffer
|
protected int |
lineBufferHead
|
protected int |
lineBufferTail
|
protected int |
maxCol
|
protected int |
maxRow
|
protected static String |
PRINT_COMMAND
|
protected static String |
QUIT_COMMAND
|
protected static String |
SAVE_COMMAND
|
protected static int |
TAB_SIZE
|
protected int |
ungotChar
|
protected ConsoleFrame |
window
|
Constructor Summary | |
---|---|
ConsoleParent()
|
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Quits the program, saves the contents of the window, or prints the contents of the window, depending on which button is pressed. |
void |
close()
Closes the console window. |
protected void |
enableButtons(boolean enable)
Enables or disables all the buttons in the Console. |
void |
focusGained(FocusEvent e)
Sets the focus to the invisible button and then the console canvas. |
void |
focusLost(FocusEvent e)
Does nothing. |
protected void |
initialize(int rows,
int columns,
int fontSize,
String title)
Initializes the window. |
void |
keyPressed(KeyEvent e)
Places a keystroke in the keyboard buffer. |
void |
keyReleased(KeyEvent e)
Does nothing. |
void |
keyTyped(KeyEvent e)
Does nothing. |
protected void |
mainStopped()
This method is invoked if the "main" method appears to have stopped executing. |
void |
print(boolean value)
Writes the text representation of a boolean to the Console. |
void |
print(boolean value,
int fieldSize)
Writes the text representation of a boolean to the Console with a specified field size. |
void |
print(byte number)
Writes the text representation of an 8-bit integer (a "byte") to the Console. |
void |
print(byte number,
int fieldSize)
Writes the text representation of an 8-bit integer (a "byte") to the Console with a specified field size. |
void |
print(char ch)
Writes a character to the Console. |
void |
print(char ch,
int fieldSize)
Writes a character to the Console with a specified field size.. |
void |
print(double number)
Writes a double precision floating point number (a "double") to the Console. |
void |
print(double number,
int fieldSize)
Writes a double precision floating point number (a "double") to the Console with a specified field size. |
void |
print(double number,
int fieldSize,
int decimalPlaces)
Writes a double precision floating point number (a "double") to the Console with a specified field size and a specified number of decimal places. |
void |
print(float number)
Writes a floating point number (a "float") to the Console. |
void |
print(float number,
int fieldSize)
Writes a floating point number (a "float") to the Console with a specified field size. |
void |
print(float number,
int fieldSize,
int decimalPlaces)
Writes a floating point number (a "double") to the Console with a specified field size and a specified number of decimal places. |
void |
print(int number)
Writes the text representation of an 32-bit integer (an "int") to the Console. |
void |
print(int number,
int fieldSize)
Writes the text representation of an 32-bit integer (an "int") to the Console with a specified field size. |
void |
print(long number)
Writes the text representation of an 64-bit integer (a "long") to the Console. |
void |
print(long number,
int fieldSize)
Writes the text representation of an 64-bit integer (a "long") to the Console with a specified field size. |
void |
print(short number)
Writes the text representation of an 16-bit integer (a "short") to the Console. |
void |
print(short number,
int fieldSize)
Writes the text representation of an 16-bit integer (a "short") to the Console with a specified field size. |
abstract void |
print(String text)
Writes a string to the Console. |
void |
print(String text,
int fieldSize)
Writes a string to the Console with a specified field size.. |
void |
println()
Writes a newline to the Console. |
void |
println(boolean value)
Writes the text representation of a boolean to the Console followed by a newline. |
void |
println(boolean value,
int fieldSize)
Writes the text representation of a boolean to the Console with a specified field size followed by a newline. |
void |
println(byte number)
Writes the text representation of an 8-bit integer (a "byte") to the Console followed by a newline. |
void |
println(byte number,
int fieldSize)
Writes the text representation of an 8-bit integer (a "byte") to the Console with a specified field size followed by a newline. |
void |
println(char ch)
Writes a character to the Console followed by a newline. |
void |
println(char ch,
int fieldSize)
Writes a character to the Console with a specified field size.. |
void |
println(double number)
Writes a double precision floating point number (a "double") to the Console followed by a newline. |
void |
println(double number,
int fieldSize)
Writes a double precision floating point number (a "double") to the Console with a specified field size followed by a newline. |
void |
println(double number,
int fieldSize,
int decimalPlaces)
Writes a double precision floating point number (a "double") to the Console with a specified field size and a specified number of decimal places followed by a newline. |
void |
println(float number)
Writes a floating point number (a "float") to the Console followed by a newline. |
void |
println(float number,
int fieldSize)
Writes a floating point number (a "float") to the Console with a specified field size followed by a newline. |
void |
println(float number,
int fieldSize,
int decimalPlaces)
Writes a floating point number (a "double") to the Console with a specified field size and a specified number of decimal places followed by a newline. |
void |
println(int number)
Writes the text representation of an 32-bit integer (an "int") to the Console followed by a newline. |
void |
println(int number,
int fieldSize)
Writes the text representation of an 32-bit integer (an "int") to the Console with a specified field size followed by a newline. |
void |
println(long number)
Writes the text representation of an 64-bit integer (a "long") to the Console followed by a newline. |
void |
println(long number,
int fieldSize)
Writes the text representation of an 64-bit integer (a "long") to the Console with a specified field size followed by a newline. |
void |
println(short number)
Writes the text representation of an 16-bit integer (a "short") to the Console followed by a newline. |
void |
println(short number,
int fieldSize)
Writes the text representation of an 16-bit integer (a "short") to the Console with a specified field size followed by a newline. |
void |
println(String text)
Writes a string to the Console followed by a newline. |
void |
println(String text,
int fieldSize)
Writes a string to the Console with a specified field size followed by a newline. |
protected void |
quitProgram()
Hides the window and quits the program. |
boolean |
readBoolean()
Reads a boolean from the Console. |
byte |
readByte()
Reads an 8-bit integer (a "byte") from the Console. |
abstract char |
readChar()
Reads a single character from the Console. |
double |
readDouble()
Reads a double precision floating point number (a "double") from the Console. |
float |
readFloat()
Reads a floating point number (a "float") from the Console. |
int |
readInt()
Reads a 32-bit integer (an "int") from the Console. |
String |
readLine()
Reads a full line of text from the Console. |
long |
readLong()
Reads a 64-bit integer (a "long") from the Console. |
short |
readShort()
Reads a 16-bit integer (a "short") from the Console. |
String |
readString()
Reads a whitespace delimited token from the Console. |
protected String |
readToken()
Reads in input from the keyboard buffer until it hits a whitespace, which indicates the end of a token. |
protected void |
setWindowTitle(String s)
Sets the window title. |
void |
windowActivated(WindowEvent e)
Does nothing. |
void |
windowClosed(WindowEvent e)
Does nothing. |
void |
windowClosing(WindowEvent e)
Quits the program. |
void |
windowDeactivated(WindowEvent e)
Does nothing. |
void |
windowDeiconified(WindowEvent e)
Does nothing. |
void |
windowIconified(WindowEvent e)
Does nothing. |
void |
windowOpened(WindowEvent e)
Does nothing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int BUFFER_SIZE
ConsoleCanvas consoleCanvas
protected Panel consoleCanvasPanelInner
protected static final int DEFAULT_COLUMNS
protected static final int DEFAULT_FONT_SIZE
protected static final int DEFAULT_ROWS
protected static final String DEFAULT_TITLE
protected static final int EMPTY_BUFFER
protected boolean eofReached
protected char[] kbdBuffer
protected int kbdBufferHead
protected int kbdBufferTail
protected char[] lineBuffer
protected int lineBufferHead
protected int lineBufferTail
protected int maxCol
protected int maxRow
protected static final String PRINT_COMMAND
protected static final String QUIT_COMMAND
protected static final String SAVE_COMMAND
protected static final int TAB_SIZE
protected int ungotChar
protected ConsoleFrame window
Constructor Detail |
---|
ConsoleParent()
Method Detail |
---|
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public void close()
protected void enableButtons(boolean enable)
public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
protected void initialize(int rows, int columns, int fontSize, String title)
public void keyPressed(KeyEvent e)
keyPressed
in interface KeyListener
public void keyReleased(KeyEvent e)
keyReleased
in interface KeyListener
public void keyTyped(KeyEvent e)
keyTyped
in interface KeyListener
protected void mainStopped()
public void print(boolean value)
value
- The boolean to be written to the Console.public void print(boolean value, int fieldSize)
value
- The boolean to be written to the Console.fieldSize
- The field width that the boolean is to be written in.public void print(byte number)
number
- The number to be written to the Console.public void print(byte number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void print(char ch)
ch
- The character to be written to the Console.public void print(char ch, int fieldSize)
ch
- The character to be written to the Console.fieldSize
- The field width that the character is to be written in.public void print(double number)
number
- The number to be written to the Console.public void print(double number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void print(double number, int fieldSize, int decimalPlaces)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.decimalPlaces
- The number of decimal places of the number
to be displayed.public void print(float number)
number
- The number to be written to the Console.public void print(float number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void print(float number, int fieldSize, int decimalPlaces)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.decimalPlaces
- The number of decimal places of the number
to be displayed.public void print(int number)
number
- The number to be written to the Console.public void print(int number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void print(long number)
number
- The number to be written to the Console.public void print(long number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void print(short number)
number
- The number to be written to the Console.public void print(short number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public abstract void print(String text)
text
- The string to be written to the Console.
This procedure is slightly complicated by the fact that if the
line of text went to the end of the line exactly and was followed
by a newline, then we only perform one newline.public void print(String text, int fieldSize)
text
- The string to be written to the Console.fieldSize
- The field width that the string is to be written in.public void println()
public void println(boolean value)
value
- The boolean to be written to the Console.public void println(boolean value, int fieldSize)
value
- The boolean to be written to the Console.fieldSize
- The field width that the boolean is to be written in.public void println(byte number)
number
- The number to be written to the Console.public void println(byte number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void println(char ch)
ch
- The character to be written to the Console.public void println(char ch, int fieldSize)
ch
- The character to be written to the Console.fieldSize
- The field width that the character is to be written in.public void println(double number)
number
- The number to be written to the Console.public void println(double number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void println(double number, int fieldSize, int decimalPlaces)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.decimalPlaces
- The number of decimal places of the number
to be displayed.public void println(float number)
number
- The number to be written to the Console.public void println(float number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void println(float number, int fieldSize, int decimalPlaces)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.decimalPlaces
- The number of decimal places of the number
to be displayed.public void println(int number)
number
- The number to be written to the Console.public void println(int number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void println(long number)
number
- The number to be written to the Console.public void println(long number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void println(short number)
number
- The number to be written to the Console.public void println(short number, int fieldSize)
number
- The number to be written to the Console.fieldSize
- The field width that the number is to be written in.public void println(String text)
text
- The string to be written to the Console.public void println(String text, int fieldSize)
text
- The string to be written to the Console.fieldSize
- The field width that the string is to be written in.protected void quitProgram()
public boolean readBoolean()
public byte readByte()
public abstract char readChar()
public double readDouble()
public float readFloat()
public int readInt()
public String readLine()
public long readLong()
public short readShort()
public String readString()
protected String readToken()
protected void setWindowTitle(String s)
e
- The window eventpublic void windowActivated(WindowEvent e)
windowActivated
in interface WindowListener
e
- The window eventpublic void windowClosed(WindowEvent e)
windowClosed
in interface WindowListener
e
- The window eventpublic void windowClosing(WindowEvent e)
windowClosing
in interface WindowListener
e
- The window eventpublic void windowDeactivated(WindowEvent e)
windowDeactivated
in interface WindowListener
e
- The window eventpublic void windowDeiconified(WindowEvent e)
windowDeiconified
in interface WindowListener
e
- The window eventpublic void windowIconified(WindowEvent e)
windowIconified
in interface WindowListener
e
- The window eventpublic void windowOpened(WindowEvent e)
windowOpened
in interface WindowListener
e
- The window event
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |