|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Canvas
ConsoleCanvas
abstract class ConsoleCanvas
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Canvas |
---|
Canvas.AccessibleAWTCanvas |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected static String |
CONSOLE_CURSOR_THREAD_NAME
The name of thread for blinking the cursor. |
protected int |
cursorBlinking
|
protected Thread |
cursorThread
Information about the cursor. |
protected boolean |
cursorVisible
|
protected static int |
DEPTH
|
protected Font |
font
Information about the font used for text drawing. |
protected int |
fontBase
|
protected int |
fontHeight
|
protected int |
fontWidth
|
protected static int |
GREY_MARGIN
|
protected boolean |
hasFocus
|
protected boolean |
macOSX
|
protected static int |
MARGIN
Constants for drawing the pane. |
protected int |
numCols
|
protected int |
numRows
|
protected int |
numXPixels
|
protected int |
numYPixels
|
protected ConsoleParent |
parentConsole
Variables for controlling the consoleCanvas pane. |
protected SavePrint |
savePrint
|
protected static String |
SCREEN_UPDATER_THREAD_NAME
|
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 | |
---|---|
ConsoleCanvas(ConsoleParent parent,
int rows,
int columns,
int fontSize)
Creates the console canvas given the size of the screen in rows and columns and font size. |
Method Summary | |
---|---|
void |
addNotify()
Overrides addNotify in order to set up the cursor thread once the canvas has been created. |
protected void |
blinkCursor()
Blinks the cursor off it was on and on if it was off. |
void |
focusGained(FocusEvent e)
Changes the cursor from an empty square to a normal cursor. |
void |
focusLost(FocusEvent e)
Changes the cursor from a normal cursor to an empty square. |
abstract int |
getCurrentColumn()
Returns the current column number of the cursor. |
abstract int |
getCurrentRow()
Returns the current row number of the cursor. |
Dimension |
getMinimumSize()
Overrides the getMinimumSize method to specify the proper canvas size |
Dimension |
getPreferredSize()
Overrides the getPreferredSize method to specify the proper canvas size |
void |
invertScreen()
Inverts the console canvas for 50 milliseconds. |
boolean |
isFocusTraversable()
|
protected boolean |
isMainRunning()
This returns whether the main method is still alive. |
void |
killCursorThread()
Kills the cursor thread (used when the Console window is closed). |
void |
printContents()
Prints the contents of the window on the printer. |
void |
run()
ConsoleCanvas implements the Runnable interface. |
void |
saveContents()
Saves the contents of the window to a file. |
void |
setCursorVisible(boolean visible)
Makes the blinking cursor visible or invisible. |
protected void |
toggleCursor()
Toggles the visible cursor on the screen off or on. |
void |
update(Graphics g)
Overrides the update method to redraw the screen using doDraw |
Methods inherited from class java.awt.Canvas |
---|
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, paint |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final String CONSOLE_CURSOR_THREAD_NAME
protected int cursorBlinking
protected Thread cursorThread
protected boolean cursorVisible
protected static final int DEPTH
protected Font font
protected int fontBase
protected int fontHeight
protected int fontWidth
protected static final int GREY_MARGIN
protected boolean hasFocus
protected boolean macOSX
protected static final int MARGIN
protected int numCols
protected int numRows
protected int numXPixels
protected int numYPixels
protected ConsoleParent parentConsole
protected SavePrint savePrint
protected static final String SCREEN_UPDATER_THREAD_NAME
Constructor Detail |
---|
public ConsoleCanvas(ConsoleParent parent, int rows, int columns, int fontSize)
parent
- The parent Console class.rows
- The height of the canvas in rows of text.columns
- The width of the canvas in columns of text.fontSize
- The size of the font in the canvas.Method Detail |
---|
public void addNotify()
addNotify
in class Canvas
protected void blinkCursor()
public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
public abstract int getCurrentColumn()
public abstract int getCurrentRow()
public Dimension getMinimumSize()
getMinimumSize
in class Component
public Dimension getPreferredSize()
getPreferredSize
in class Component
public void invertScreen()
public boolean isFocusTraversable()
isFocusTraversable
in class Component
protected boolean isMainRunning()
public void killCursorThread()
public void printContents()
public void run()
run
in interface Runnable
public void saveContents()
public void setCursorVisible(boolean visible)
visible
- Whether the cursor should be visible or not.protected void toggleCursor()
public void update(Graphics g)
update
in class Canvas
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |