|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectConsoleParent
Console
public class Console
Field Summary | |
---|---|
protected int |
actualCol
|
protected int |
actualRow
|
protected boolean |
clearToEOL
|
protected int |
currentCol
Console text variables |
protected int |
currentRow
Console text variables |
protected boolean |
echoOn
|
protected Font |
font
|
protected ConsoleCanvasGraphics |
graphicsCanvas
|
protected Color |
graphicsColor
Console graphics variables |
protected static boolean |
mainReturned
|
protected int |
startCol
|
protected int |
startRow
|
protected Color |
textBGColor
|
protected Color |
textColor
|
Fields inherited from class ConsoleParent |
---|
BUFFER_SIZE, consoleCanvas, consoleCanvasPanelInner, DEFAULT_COLUMNS, DEFAULT_FONT_SIZE, DEFAULT_ROWS, DEFAULT_TITLE, EMPTY_BUFFER, eofReached, kbdBuffer, kbdBufferHead, kbdBufferTail, lineBuffer, lineBufferHead, lineBufferTail, maxCol, maxRow, PRINT_COMMAND, QUIT_COMMAND, SAVE_COMMAND, TAB_SIZE, ungotChar, window |
Constructor Summary | |
---|---|
Console()
Creates a console using the default values of: 25x80 screen, 14 pt font, "Console" as title. |
|
Console(int fontSize)
Creates a console using the default values of: 25x80 screen, "Console" as title. |
|
Console(int rows,
int columns)
Creates a console using the default values of: 14 pt font, "Console" as title. |
|
Console(int rows,
int columns,
int fontSize)
Creates a console using the default values of: "Console" as title. |
|
Console(int rows,
int columns,
int fontSize,
String title)
Creates a console. |
|
Console(int rows,
int columns,
String title)
Creates a console using the default values of: 14 pt font. |
|
Console(int fontSize,
String title)
Creates a console using the default values of: 25x80 screen. |
|
Console(String title)
Creates a console using the default values of: 25x80 screen, 14 pt font. |
Method Summary | |
---|---|
void |
clear()
Clears the screen and moves the cursor to the top left corner. |
void |
clearRect(int x,
int y,
int width,
int height)
Clears a rectangle in the console to white. |
void |
copyArea(int x,
int y,
int width,
int height,
int delta_x,
int delta_y)
Copies an area of the screen from (x, y) to (x + width, y + height) onto the screen with top corner at (x + delta_x, y + delta_y). |
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draws a 3D rectangle on the screen from (x, y) to (x + width, y + width). |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws an arc on the screen from (x, y) to (x + width, y + height) from startAngle to startAngle + arcAngle in specified colour. |
void |
drawImage(Image img,
int x,
int y,
ImageObserver obs)
Draws an image on the screen at (x, y). |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line on the screen from (x1, y1) to (x2, y2). |
void |
drawMapleLeaf(int x,
int y,
int width,
int height)
Draws a maple leaf on the screen from (x, y) to (x + width, y + width). |
void |
drawOval(int x,
int y,
int width,
int height)
Draws an oval on the screen in the sqaure from (x, y) to (x + width, y + height). |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a polygon specified by the arrays of points. |
void |
drawRect(int x,
int y,
int width,
int height)
Draws a rectangle on the screen from (x, y) to (x + width, y + width). |
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rounded rectangle on the screen from (x, y) to (x + width, y + width). |
void |
drawStar(int x,
int y,
int width,
int height)
Draws a star on the screen from (x, y) to (x + width, y + width). |
void |
drawString(String str,
int x,
int y)
Draws a text on the screen at location (x, y). |
protected void |
eraseLineOfInput()
Erases the entire line of input. |
protected void |
erasePreviousChar()
Erases the previous character in a line of input. |
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draws a filled 3D rectangle on the screen from (x, y) to (x + width, y + width). |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws a filled arc on the screen from (x, y) to (x + width, y + height) from startAngle to startAngle + arcAngle in specified colour. |
void |
fillMapleLeaf(int x,
int y,
int width,
int height)
Draws a filled maple leaf on the screen from (x, y) to (x + width, y + width). |
void |
fillOval(int x,
int y,
int width,
int height)
Draws a filled oval on the screen in the sqaure from (x, y) to (x + width, y + height). |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a filled polygon specified by the arrays of points.. |
void |
fillRect(int x,
int y,
int width,
int height)
Draws a filled rectangle on the screen from (x, y) to (x + width, y + width). |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a filled rounded rectangle on the screen from (x, y) to (x + width, y + width). |
void |
fillStar(int x,
int y,
int width,
int height)
Draws a filled star on the screen from (x, y) to (x + width, y + width). |
char |
getChar()
Returns the next character entered on the keyboard. |
int |
getColumn()
Returns the current column number of the cursor. |
int |
getHeight()
Returns the height of the console drawing surface in pixels. |
int |
getMaxColumns()
Returns the number of columns in the console window. |
int |
getMaxRows()
Returns the number of rows in the console window. |
int |
getRow()
Returns the current row number of the cursor. |
int |
getWidth()
Returns the width of the console drawing surface in pixels. |
boolean |
isCharAvail()
Returns whether a character is available in the keyboard buffer. |
static void |
mainReturned()
|
int |
maxcol()
Returns the number of columns in the console window. |
int |
maxrow()
Returns the number of rows in the console window. |
int |
maxx()
Returns the maximum x coordinate of the console window in pixels. |
int |
maxy()
Returns the maximum y coordinate of the console window in pixels. |
void |
print(String text)
Write a string to the Console. |
char |
readChar()
Reads a single character from the Console. |
void |
setColor(Color color)
Sets the foreground color for any graphics. |
void |
setColour(Color colour)
Sets the foreground colour for any graphics. |
void |
setCursor(int row,
int column)
Moves the cursor to the specified row and column. |
void |
setCursorVisible(boolean visible)
Makes the blinking cursor visible or invisible. |
void |
setFont(Font font)
Sets the font for the drawString method. |
void |
setPaintMode()
Sets the drawing mode for any graphics to "Paint". |
void |
setTextBackgroundColor(Color color)
Sets the background color for any text. |
void |
setTextBackgroundColour(Color colour)
Sets the background color for any text. |
void |
setTextColor(Color color)
Sets the foreground color for any text. |
void |
setTextColour(Color colour)
Sets the foreground colour for any text. |
void |
setXORMode(Color xorColor)
Sets the drawing mode for any graphics to "XOR". |
Methods inherited from class ConsoleParent |
---|
actionPerformed, close, enableButtons, focusGained, focusLost, initialize, keyPressed, keyReleased, keyTyped, mainStopped, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, println, quitProgram, readBoolean, readByte, readDouble, readFloat, readInt, readLine, readLong, readShort, readString, readToken, setWindowTitle, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int actualCol
protected int actualRow
protected boolean clearToEOL
protected int currentCol
protected int currentRow
protected boolean echoOn
protected Font font
protected ConsoleCanvasGraphics graphicsCanvas
protected Color graphicsColor
protected static boolean mainReturned
protected int startCol
protected int startRow
protected Color textBGColor
protected Color textColor
Constructor Detail |
---|
public Console()
public Console(int fontSize)
fontSize
- The size of the font to be used in the Console windowpublic Console(int rows, int columns)
rows
- The height of the window in rowscolumns
- The width of the window in columnspublic Console(int rows, int columns, int fontSize)
rows
- The height of the window in rowscolumns
- The width of the window in columnsfontSize
- The size of the font to be used in the Console windowpublic Console(int rows, int columns, int fontSize, String title)
rows
- The height of the window in rowscolumns
- The width of the window in columnsfontSize
- The size of the font to be used in the Console windowtitle
- The title of the Console windowpublic Console(int rows, int columns, String title)
rows
- The height of the window in rowscolumns
- The width of the window in columnstitle
- The title of the Console windowpublic Console(int fontSize, String title)
fontSize
- The size of the font to be used in the Console window.title
- The title of the Console window.public Console(String title)
title
- The title of the Console windowMethod Detail |
---|
public void clear()
public void clearRect(int x, int y, int width, int height)
Graphics.clearRect
public void copyArea(int x, int y, int width, int height, int delta_x, int delta_y)
Graphics.copyArea
public void draw3DRect(int x, int y, int width, int height, boolean raised)
Graphics.draw3DRect
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Graphics.drawArc
public void drawImage(Image img, int x, int y, ImageObserver obs)
Graphics.drawImage
public void drawLine(int x1, int y1, int x2, int y2)
Graphics.drawLine
public void drawMapleLeaf(int x, int y, int width, int height)
x
- The x coordinate of the top left corner of the
rectangle that the maple leaf is inscribed in.y
- The y coordinate of the top left corner of the
rectangle that the maple leaf is inscribed in.width
- The width of the rectangle that the
maple leaf is inscribed in.height
- The height of the rectangle that the
maple leaf is inscribed in.public void drawOval(int x, int y, int width, int height)
Graphics.drawOval
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Graphics.drawPolygon
public void drawRect(int x, int y, int width, int height)
Graphics.drawRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Graphics.drawRoundRect
public void drawStar(int x, int y, int width, int height)
x
- The x coordinate of the top left corner of the
rectangle that the star is inscribed in.y
- The y coordinate of the top left corner of the
rectangle that the star is inscribed in.width
- The width of the rectangle that the
star is inscribed in.height
- The height of the rectangle that the
star is inscribed in.public void drawString(String str, int x, int y)
Graphics.drawString
protected void eraseLineOfInput()
protected void erasePreviousChar()
public void fill3DRect(int x, int y, int width, int height, boolean raised)
Graphics.fill3DRect
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Graphics.fillArc
public void fillMapleLeaf(int x, int y, int width, int height)
x
- int The x coordinate of the top left corner of the
rectangle that the maple leaf is inscribed in.y
- int The y coordinate of the top left corner of the
rectangle that the maple leaf is inscribed in.width
- int The width of the rectangle that the
maple leaf is inscribed in.height
- int The height of the rectangle that the
maple leaf is inscribed in.public void fillOval(int x, int y, int width, int height)
Graphics.fillOval
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Graphics.fillPolygon
public void fillRect(int x, int y, int width, int height)
Graphics.fillRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Graphics.fillRoundRect
public void fillStar(int x, int y, int width, int height)
x
- The x coordinate of the top left corner of the
rectangle that the star is inscribed in.y
- The y coordinate of the top left corner of the
rectangle that the star is inscribed in.width
- The width of the rectangle that the
star is inscribed in.height
- The height of the rectangle that the
star is inscribed in.public char getChar()
public int getColumn()
public int getHeight()
public int getMaxColumns()
public int getMaxRows()
public int getRow()
public int getWidth()
public boolean isCharAvail()
public static void mainReturned()
public int maxcol()
public int maxrow()
public int maxx()
public int maxy()
public void print(String text)
print
in class ConsoleParent
text
- The string to be written to the Consolepublic char readChar()
readChar
in class ConsoleParent
public void setColor(Color color)
Graphics.setColor
public void setColour(Color colour)
Graphics.setColor
public void setCursor(int row, int column)
row
- The row to move the cursor tocolumn
- The column to move the cursor topublic void setCursorVisible(boolean visible)
public void setFont(Font font)
Graphics.setFont
public void setPaintMode()
Graphics.setPaintMode
public void setTextBackgroundColor(Color color)
color
- The color that text displayed by print and println
methods will appear on.public void setTextBackgroundColour(Color colour)
colour
- The color that text displayed by print and println
methods will appear on.public void setTextColor(Color color)
color
- The color that text displayed by print and println
methods will appear in.public void setTextColour(Color colour)
colour
- The color that text displayed by print and println
methods will appear in.public void setXORMode(Color xorColor)
Graphics.setXORMode
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |