|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--de.mud.terminal.VDU
Video Display Unit emulation. This class implements all necessary features of a character display unit, but not the actual terminal emulation. It can be used as the base for terminal emulations of any kind.
This is a lightweight component. It will render very badly if used in standard AWT components without overloaded update() method. The update() method must call paint() immediately without clearing the components graphics context or parts of the screen will simply disappear.
Maintainer: Matthias L. Jugel
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
static int |
BOLD
Make character bold. |
static int |
COLOR
|
static int |
COLOR_0
|
static int |
COLOR_1
|
static int |
COLOR_2
|
static int |
COLOR_3
|
static int |
COLOR_4
|
static int |
COLOR_5
|
static int |
COLOR_6
|
static int |
COLOR_7
|
static int |
COLOR_BG
|
static int |
COLOR_BOLD
|
static int |
COLOR_FG
|
static int |
COLOR_INVERT
|
static int |
debug
Enable debug messages. |
static java.lang.String |
ID
The current version id tag |
static int |
INVERT
Invert character. |
static int |
LOW
Lower intensity character. |
static int |
NORMAL
Make character normal. |
static int |
RESIZE_FONT
Resize the font to the new screen size. |
static int |
RESIZE_NONE
Do nothing when the component is resized. |
static int |
RESIZE_SCREEN
Resize the width and height of the character screen. |
static boolean |
SCROLL_DOWN
Scroll down when inserting a line. |
static boolean |
SCROLL_UP
Scroll up when inserting a line. |
static int |
UNDERLINE
Underline character. |
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 | |
VDU()
Create a display unit with size 80x24 and Font "Monospaced", size 12. |
|
VDU(java.awt.Font font)
Create a display with the font passed and size 80x24. |
|
VDU(int width,
int height)
Create a display unit with specific size, Font is "Monospaced", size 12. |
|
VDU(int width,
int height,
java.awt.Font font)
Create a new video display unit with the passed width and height in characters using a special font and font size. |
Method Summary | |
void |
addFocusListener(java.awt.event.FocusListener listener)
|
void |
addKeyListener(java.awt.event.KeyListener listener)
Add a key listener to the VDU. |
void |
addMouseListener(java.awt.event.MouseListener listener)
Add a mouse listener to the VDU. |
void |
addMouseMotionListener(java.awt.event.MouseMotionListener listener)
Add a mouse motion listener to the VDU. |
void |
clearSelection()
|
void |
deleteArea(int c,
int l,
int w,
int h)
Delete a rectangular portion of the screen. |
void |
deleteArea(int c,
int l,
int w,
int h,
int curAttr)
Delete a rectangular portion of the screen. |
void |
deleteChar(int c,
int l)
Delete a character at a given position on the screen. |
void |
deleteLine(int l)
Delete a line at a specific position. |
int |
getAttributes(int c,
int l)
Get the attributes for the specified position. |
int |
getBottomMargin()
Get the bottom scroll margin. |
int |
getBufferSize()
Retrieve current scrollback buffer size. |
char |
getChar(int c,
int l)
Get the character at the specified position. |
java.awt.Color[] |
getColorSet()
|
int |
getColumns()
Get amount of columns on the screen. |
java.awt.Dimension |
getCursorPosition()
Get the current cursor position. |
java.awt.Insets |
getInsets()
The insets of the character display define the border. |
int |
getMaxBufferSize()
Retrieve maximum buffer Size. |
java.awt.Dimension |
getPreferredSize()
Return the preferred Size of the character display. |
int |
getRows()
Get amount of rows on the screen. |
java.awt.Dimension |
getScreenSize()
Get the screen size in rows and columns. |
java.lang.String |
getSelection()
|
java.awt.Dimension |
getSize()
Return the real size in points of the character display. |
int |
getTopMargin()
Get the top scroll margin. |
int |
getWindowBase()
Get the current window base. |
void |
insertChar(int c,
int l,
char ch,
int attributes)
Insert a character at a specific position on the screen. |
void |
insertLine(int l)
Insert a blank line at a specific position. |
void |
insertLine(int l,
boolean scrollDown)
Insert a blank line at a specific position. |
void |
insertLine(int l,
int n)
Insert blank lines at a specific position. |
void |
insertLine(int l,
int n,
boolean scrollDown)
Insert blank lines at a specific position. |
void |
markLine(int l,
int n)
Mark lines to be updated with redraw(). |
void |
mouseClicked(java.awt.event.MouseEvent evt)
|
void |
mouseDragged(java.awt.event.MouseEvent evt)
|
void |
mouseEntered(java.awt.event.MouseEvent evt)
|
void |
mouseExited(java.awt.event.MouseEvent evt)
|
java.awt.Point |
mouseGetPos(java.awt.Point evtpt)
Convert Mouse Event coordinates into character cell coordinates |
void |
mouseMoved(java.awt.event.MouseEvent evt)
|
void |
mousePressed(java.awt.event.MouseEvent evt)
Handle mouse pressed events for copy & paste. |
void |
mouseReleased(java.awt.event.MouseEvent evt)
Handle mouse released events for copy & paste. |
void |
paint(java.awt.Graphics g)
Paint the current screen using the backing store image. |
void |
print(java.awt.Graphics g)
|
void |
processFocusEvent(java.awt.event.FocusEvent evt)
|
void |
processKeyEvent(java.awt.event.KeyEvent evt)
Process key events for this component. |
void |
processMouseEvent(java.awt.event.MouseEvent evt)
Process mouse events for this component. |
void |
processMouseMotionEvent(java.awt.event.MouseEvent evt)
Process mouse motion events for this component. |
void |
putChar(int c,
int l,
char ch)
Put a character on the screen with normal font and outline. |
void |
putChar(int c,
int l,
char ch,
int attributes)
Put a character on the screen with specific font and outline. |
void |
putString(int c,
int l,
java.lang.String s)
Put a String at a specific position. |
void |
putString(int c,
int l,
java.lang.String s,
int attributes)
Put a String at a specific position giving all characters the same attributes. |
void |
redraw()
Redraw marked lines. |
protected void |
redraw(java.awt.Graphics g)
|
void |
removeFocusListener(java.awt.event.FocusListener listener)
|
void |
removeKeyListener(java.awt.event.KeyListener listener)
Remove key listener from the VDU. |
void |
removeMouseListener(java.awt.event.MouseListener listener)
Remove a mouse listener to the VDU. |
void |
removeMouseMotionListener(java.awt.event.MouseMotionListener listener)
Remove a mouse motion listener to the VDU. |
void |
setBorder(int thickness,
boolean raised)
Set the border thickness and the border type. |
void |
setBottomMargin(int l)
Set the bottom scroll margin for the screen. |
void |
setBounds(int x,
int y,
int w,
int h)
Reshape character display according to resize strategy. |
void |
setBufferSize(int amount)
Set scrollback buffer size. |
void |
setColorPrinting(boolean colorPrint)
Set default for printing black&white or colorized as displayed on screen. |
void |
setColorSet(java.awt.Color[] colorset)
|
void |
setCursorColors(java.awt.Color fg,
java.awt.Color bg)
Set cursor FG and BG colors |
void |
setCursorPosition(int c,
int l)
Puts the cursor at the specified position. |
void |
setFont(java.awt.Font font)
Set the font to be used for rendering the characters on screen. |
void |
setResizeStrategy(int strategy)
Set the strategy when window is resized. |
void |
setScreenSize(int width,
int height)
Change the size of the screen. |
void |
setScrollbar(java.awt.Scrollbar scrollBar)
Connect a scrollbar to the VDU. |
void |
setTopMargin(int l)
Set the top scroll margin for the screen. |
void |
setWindowBase(int line)
Set the current window base. |
void |
showCursor(boolean doshow)
|
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, printAll, processComponentEvent, processEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String ID
public static final int debug
public static final int COLOR_0
public static final int COLOR_1
public static final int COLOR_2
public static final int COLOR_3
public static final int COLOR_4
public static final int COLOR_5
public static final int COLOR_6
public static final int COLOR_7
public static final int COLOR_BOLD
public static final int COLOR_INVERT
public static final int COLOR
public static final int COLOR_FG
public static final int COLOR_BG
public static final boolean SCROLL_UP
public static final boolean SCROLL_DOWN
public static final int RESIZE_NONE
public static final int RESIZE_SCREEN
public static final int RESIZE_FONT
public static final int NORMAL
public static final int BOLD
public static final int UNDERLINE
public static final int INVERT
public static final int LOW
Constructor Detail |
public VDU(int width, int height, java.awt.Font font)
width
- the length of the character linesheight
- the amount of lines on the screenfont
- the font to be used (usually Monospaced)public VDU(int width, int height)
width
- the length of the character linesheight
- the amount of lines on the screenpublic VDU(java.awt.Font font)
font
- the font to be used (usually Monospaced)public VDU()
Method Detail |
public void setColorSet(java.awt.Color[] colorset)
public java.awt.Color[] getColorSet()
public void putChar(int c, int l, char ch)
c
- x-coordinate (column)l
- y-coordinate (line)ch
- the character to show on the screeninsertChar(int, int, char, int)
,
deleteChar(int, int)
,
redraw()
public void putChar(int c, int l, char ch, int attributes)
c
- x-coordinate (column)l
- y-coordinate (line)ch
- the character to show on the screenattributes
- the character attributesBOLD
,
UNDERLINE
,
INVERT
,
NORMAL
,
insertChar(int, int, char, int)
,
deleteChar(int, int)
,
redraw()
public char getChar(int c, int l)
c
- x-coordinate (column)l
- y-coordinate (line)putChar(int, int, char)
public int getAttributes(int c, int l)
c
- x-coordinate (column)l
- y-coordinate (line)putChar(int, int, char)
public void insertChar(int c, int l, char ch, int attributes)
c
- x-coordinate (column)l
- y-coordinate (line)ch
- the character to insertattributes
- the character attributesBOLD
,
UNDERLINE
,
INVERT
,
NORMAL
,
putChar(int, int, char)
,
deleteChar(int, int)
,
redraw()
public void deleteChar(int c, int l)
c
- x-coordinate (column)l
- y-coordinate (line)putChar(int, int, char)
,
insertChar(int, int, char, int)
,
redraw()
public void putString(int c, int l, java.lang.String s)
c
- x-coordinate (column)l
- y-coordinate (line)s
- the string to be shown on the screenBOLD
,
UNDERLINE
,
INVERT
,
NORMAL
,
putChar(int, int, char)
,
insertLine(int)
,
deleteLine(int)
,
redraw()
public void putString(int c, int l, java.lang.String s, int attributes)
c
- x-coordinate (column)l
- y-coordinate (line)s
- the string to be shown on the screenattributes
- character attributesBOLD
,
UNDERLINE
,
INVERT
,
NORMAL
,
putChar(int, int, char)
,
insertLine(int)
,
deleteLine(int)
,
redraw()
public void insertLine(int l)
l
- the y-coordinate to insert the linedeleteLine(int)
,
redraw()
public void insertLine(int l, int n)
l
- the y-coordinate to insert the linen
- amount of lines to be inserteddeleteLine(int)
,
redraw()
public void insertLine(int l, boolean scrollDown)
l
- the y-coordinate to insert the linescrollDown
- scroll downdeleteLine(int)
,
SCROLL_UP
,
SCROLL_DOWN
,
redraw()
public void insertLine(int l, int n, boolean scrollDown)
l
- the y-coordinate to insert the linen
- number of lines to be insertedscrollDown
- scroll downdeleteLine(int)
,
SCROLL_UP
,
SCROLL_DOWN
,
redraw()
public void deleteLine(int l)
l
- the y-coordinate to insert the linedeleteLine(int)
public void deleteArea(int c, int l, int w, int h, int curAttr)
c
- x-coordinate (column)l
- y-coordinate (row)w
- with of the area in charactersh
- height of the area in characterscurAttr
- attribute to filldeleteChar(int, int)
,
deleteLine(int)
,
redraw
public void deleteArea(int c, int l, int w, int h)
c
- x-coordinate (column)l
- y-coordinate (row)w
- with of the area in charactersh
- height of the area in charactersdeleteChar(int, int)
,
deleteLine(int)
,
redraw
public void setCursorPosition(int c, int l)
c
- columnl
- linepublic void showCursor(boolean doshow)
public java.awt.Dimension getCursorPosition()
Dimension
public void setTopMargin(int l)
l
- line that is the marginpublic int getTopMargin()
public void setBottomMargin(int l)
l
- line that is the marginpublic int getBottomMargin()
public void setBufferSize(int amount)
amount
- new size of the bufferpublic int getBufferSize()
setBufferSize(int)
public int getMaxBufferSize()
getBufferSize()
public void setWindowBase(int line)
line
- the line where the screen window startssetBufferSize
,
getBufferSize
public int getWindowBase()
setWindowBase
public void setFont(java.awt.Font font)
setFont
in class java.awt.Component
font
- the new font to be used.public void setScreenSize(int width, int height)
columns
- width of the screencolumns
- height of the screenpublic java.awt.Dimension getScreenSize()
public void setResizeStrategy(int strategy)
strategy
- the strategyRESIZE_NONE
,
RESIZE_FONT
,
RESIZE_SCREEN
public int getRows()
public int getColumns()
public void setBorder(int thickness, boolean raised)
thickness
- border thickness in pixels, zero means no borderraised
- a boolean indicating a raised or embossed borderpublic void setScrollbar(java.awt.Scrollbar scrollBar)
scrollBar
- the scroll barpublic void markLine(int l, int n)
l
- starting linen
- amount of lines to be updatedredraw()
public void redraw()
markLine(int, int)
protected void redraw(java.awt.Graphics g)
public void paint(java.awt.Graphics g)
paint
in class java.awt.Component
public void setColorPrinting(boolean colorPrint)
name
- colorPrint true = print in full color, default b&w onlypublic void print(java.awt.Graphics g)
print
in class java.awt.Component
public java.awt.Point mouseGetPos(java.awt.Point evtpt)
the
- mouse point to be convertedpublic void setCursorColors(java.awt.Color fg, java.awt.Color bg)
fg
- foreground color or nullbg
- background color or nullpublic void setBounds(int x, int y, int w, int h)
setBounds
in class java.awt.Component
setResizeStrategy(int)
public java.awt.Dimension getSize()
getSize
in class java.awt.Component
Dimension
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
size
public java.awt.Insets getInsets()
public void clearSelection()
public java.lang.String getSelection()
public void mouseMoved(java.awt.event.MouseEvent evt)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseDragged(java.awt.event.MouseEvent evt)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseClicked(java.awt.event.MouseEvent evt)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent evt)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent evt)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent evt)
mousePressed
in interface java.awt.event.MouseListener
evt
- the event that occuredMouseEvent
public void mouseReleased(java.awt.event.MouseEvent evt)
mouseReleased
in interface java.awt.event.MouseListener
evt
- the mouse eventpublic void addMouseListener(java.awt.event.MouseListener listener)
addMouseListener
in class java.awt.Component
listener
- the new mouse listenerpublic void removeMouseListener(java.awt.event.MouseListener listener)
removeMouseListener
in class java.awt.Component
listener
- the mouse listener to removepublic void addMouseMotionListener(java.awt.event.MouseMotionListener listener)
addMouseMotionListener
in class java.awt.Component
listener
- the mouse motion listenerpublic void removeMouseMotionListener(java.awt.event.MouseMotionListener listener)
removeMouseMotionListener
in class java.awt.Component
listener
- the mouse motion listener to removepublic void processMouseEvent(java.awt.event.MouseEvent evt)
processMouseEvent
in class java.awt.Component
evt
- the dispatched mouse eventpublic void processMouseMotionEvent(java.awt.event.MouseEvent evt)
processMouseMotionEvent
in class java.awt.Component
evt
- the dispatched mouse eventpublic void addKeyListener(java.awt.event.KeyListener listener)
addKeyListener
in class java.awt.Component
listener
- the key listenerpublic void removeKeyListener(java.awt.event.KeyListener listener)
removeKeyListener
in class java.awt.Component
listener
- the key listener to removepublic void processKeyEvent(java.awt.event.KeyEvent evt)
processKeyEvent
in class java.awt.Component
evt
- the dispatched key eventpublic void addFocusListener(java.awt.event.FocusListener listener)
addFocusListener
in class java.awt.Component
public void removeFocusListener(java.awt.event.FocusListener listener)
removeFocusListener
in class java.awt.Component
public void processFocusEvent(java.awt.event.FocusEvent evt)
processFocusEvent
in class java.awt.Component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |