|
|||||||
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
ConsoleCanvasGraphics
class ConsoleCanvasGraphics
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 int |
cursorCol
|
protected int |
cursorRow
|
protected boolean |
inXORMode
|
protected static int |
NO_SCALING
|
protected Image |
offscreenImage
Variables for controlling the consoleCanvas pane. |
protected Color |
xorColor
|
Fields inherited from class ConsoleCanvas |
---|
CONSOLE_CURSOR_THREAD_NAME, cursorBlinking, cursorThread, cursorVisible, DEPTH, font, fontBase, fontHeight, fontWidth, GREY_MARGIN, hasFocus, macOSX, MARGIN, numCols, numRows, numXPixels, numYPixels, parentConsole, savePrint, 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 | |
---|---|
ConsoleCanvasGraphics(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 device dependent features once the canvas has actually been created. |
void |
clearRect(int x,
int y,
int width,
int height)
Clears a rectangle on the console canvas. |
void |
clearScreen(Color bgColor)
Clears the entire console canvas to a specified colour |
void |
clearToEOL(int row,
int col,
Color bgColor)
Clears a rectangle on console canvas from the specified row and column to the end of line |
void |
copyArea(int x,
int y,
int width,
int height,
int deltaX,
int deltaY)
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,
Color color)
Draws a 3D rectangle on the screen from (x, y) to (x + width, y + height) in specified colour. |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle,
Color color)
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 at (x, y). |
void |
drawLine(int x1,
int y1,
int x2,
int y2,
Color color)
Draws a line from (x1, y1) to (x2, y2) in specified colour. |
void |
drawOval(int x,
int y,
int width,
int height,
Color color)
Draws an oval on the screen in the sqaure from (x, y) to (x + width, y + height) in specified colour. |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints,
Color color)
Draws a polygon. |
void |
drawRect(int x,
int y,
int width,
int height,
Color color)
Draws a rectangle on the screen from (x, y) to (x + width, y + height) in specified colour. |
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight,
Color color)
Draws a rounded rectangle on the screen from (x, y) to (x + width, y + height) in specified colour. |
void |
drawString(String str,
int x,
int y,
Font font,
Color color)
Draws a line from (x1, y1) to (x2, y2) in specified colour. |
void |
drawText(int row,
int col,
String text,
Color fgColor,
Color bgColor)
Draws the specified text to the screen at the specified row and column using the specified foreground and background colours. |
void |
drawWindowToGraphics(Graphics g)
This routine is used to implement the saving and printing. |
void |
drawWindowToGraphics(Graphics g,
int pageWidth,
int pageHeight)
|
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised,
Color color)
Draws a filled 3D rectangle on the screen from (x, y) to (x + width, y + height) in specified colour. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle,
Color color)
Draws a filled arc on the screen from (x, y) to (x + width, y + height) from startAngle to startAngle + arcAngle in specified colour. |
void |
fillOval(int x,
int y,
int width,
int height,
Color color)
Draws a filled oval on the screen in the sqaure from (x, y) to (x + width, y + height) in specified colour. |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints,
Color color)
Draws a filled polygon. |
void |
fillRect(int x,
int y,
int width,
int height,
Color color)
Draws a filled rectangle on the screen from (x, y) to (x + width, y + height) in specified colour. |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight,
Color color)
Draws a filled rounded rectangle on the screen from (x, y) to (x + width, y + height) in specified colour. |
int |
getCurrentColumn()
Returns the current column number of the cursor. |
int |
getCurrentRow()
Returns the current row number of the cursor. |
int |
getDrawingAreaHeight()
Returns the height of the console window in pixels. |
int |
getDrawingAreaWidth()
Returns the width of the console window in pixels. |
int |
getMargin()
|
protected Graphics |
getOffscreenGraphics(Color color)
Returns the Graphics object associated with the offscreen bitmap. |
protected Graphics |
getOnscreenGraphics(Color color)
Returns the Graphics object associated with the ConsoleCanvas. |
void |
paint(Graphics g)
Overrides the paint method to redraw the screen using doDraw |
void |
scrollUpALine(Color bgColor)
Scrolls up the entire ConsoleCanvas a single line. |
void |
setCursorPos(int row,
int col)
Sets the cursor to the specified row and column. |
void |
setPaintMode()
Sets the drawing mode for any graphics to "Paint". |
void |
setXORMode(Color xorColor)
Sets the drawing mode for any graphics to "XOR". |
Methods inherited from class ConsoleCanvas |
---|
blinkCursor, focusGained, focusLost, getMinimumSize, getPreferredSize, invertScreen, isFocusTraversable, isMainRunning, killCursorThread, printContents, run, saveContents, setCursorVisible, toggleCursor, update |
Methods inherited from class java.awt.Canvas |
---|
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int cursorCol
protected int cursorRow
protected boolean inXORMode
protected static final int NO_SCALING
protected Image offscreenImage
protected Color xorColor
Constructor Detail |
---|
public ConsoleCanvasGraphics(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 ConsoleCanvas
public void clearRect(int x, int y, int width, int height)
public void clearScreen(Color bgColor)
public void clearToEOL(int row, int col, Color bgColor)
public void copyArea(int x, int y, int width, int height, int deltaX, int deltaY)
public void draw3DRect(int x, int y, int width, int height, boolean raised, Color color)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle, Color color)
public void drawImage(Image img, int x, int y, ImageObserver obs)
public void drawLine(int x1, int y1, int x2, int y2, Color color)
public void drawOval(int x, int y, int width, int height, Color color)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints, Color color)
public void drawRect(int x, int y, int width, int height, Color color)
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, Color color)
public void drawString(String str, int x, int y, Font font, Color color)
public void drawText(int row, int col, String text, Color fgColor, Color bgColor)
public void drawWindowToGraphics(Graphics g)
drawWindowToGraphics
in interface DrawGraphics
public void drawWindowToGraphics(Graphics g, int pageWidth, int pageHeight)
drawWindowToGraphics
in interface DrawGraphics
public void fill3DRect(int x, int y, int width, int height, boolean raised, Color color)
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle, Color color)
public void fillOval(int x, int y, int width, int height, Color color)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints, Color color)
public void fillRect(int x, int y, int width, int height, Color color)
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, Color color)
public int getCurrentColumn()
getCurrentColumn
in class ConsoleCanvas
public int getCurrentRow()
getCurrentRow
in class ConsoleCanvas
public int getDrawingAreaHeight()
public int getDrawingAreaWidth()
public int getMargin()
getMargin
in interface DrawGraphics
protected Graphics getOffscreenGraphics(Color color)
protected Graphics getOnscreenGraphics(Color color)
public void paint(Graphics g)
paint
in class Canvas
public void scrollUpALine(Color bgColor)
public void setCursorPos(int row, int col)
public void setPaintMode()
public void setXORMode(Color xorColor)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |