com.mindbright.terminal
Class TerminalWin

java.lang.Object
  extended byjava.awt.event.WindowAdapter
      extended bycom.mindbright.terminal.TerminalWin
All Implemented Interfaces:
com.mindbright.terminal.DisplayController, java.util.EventListener, java.awt.event.KeyListener, TerminalWindow, java.awt.event.WindowFocusListener, java.awt.event.WindowListener, java.awt.event.WindowStateListener

public final class TerminalWin
extends java.awt.event.WindowAdapter
implements TerminalWindow, com.mindbright.terminal.DisplayController, java.awt.event.KeyListener

The actual implementation of a terminal window. The terminal window may use AWT or Swing widgets depending on the owner frame type.


Field Summary
static int LEFT_BUTTON
           
static int MIDDLE_BUTTON
           
static int RIGHT_BUTTON
           
static java.lang.String[] termColorNames
          The names of the predefined colors
static java.awt.Color[] termColors
          Predefined colors
static int UNKNOWN_BUTTON
           
 
Constructor Summary
TerminalWin(java.awt.Frame ownerFrame)
          Create a new terminal window with the default values of all properties.
TerminalWin(java.awt.Frame ownerFrame, java.util.Properties initProps)
          Create a new terminal window with the given properties.
TerminalWin(java.awt.Frame ownerFrame, java.util.Properties initProps, boolean setAsDefault)
          Create a new terminal window with the given properties.
 
Method Summary
 void addAsEntropyGenerator(RandomSeed seed)
          Casuses this terminal window to send events to the specified random seed in order to extract entropy from them
 void addInputListener(TerminalInputListener inListener)
          Add a input listener which listens to data from the user.
 void addOutputListener(TerminalOutputListener outListener)
          Add a output listener which listens to data from the server.
 void attachPrinter(TerminalPrinter printer)
          Attach a printer to this terminal.
 void clearLine()
          This shortcut method clears the current line.
 void clearSaveLines()
          Forgets any saved lines in the scrollback buffer.
 void clearScreen()
          This shortcut method clears the screen.
 void clearSelection()
          Removes the selection if there is one.
 int cols()
          Get the number of columns shown.
 void detachPrinter()
          Detach the previously attached printer.
 void displayDragResize(int newRows, int newCols)
          Resize the terminal during a drag operation.
 void displayResized(int newRows, int newCols, int vpixels, int hpixels)
          Claled when the terminal window has been resized.
 void doCopy()
          Store a copy of the selection in the clipboard.
 void doPaste()
          Paset the contents of the clipboard.
 void emulateComponentShown()
          Generate a syntetic ComponentShown event.
 TerminalClipboardHandler getClipboard()
          Get the clipboard used.
 java.lang.String getDefaultProperty(java.lang.String key)
          Get the default value of the given property.
 DisplayView getDisplay()
          Return the current display view object which handles the actual displaying of data in the terminal window.
 java.awt.Image getLogo()
          Get the logo image.
 TerminalMenuHandler getMenus()
          Return the menu handler which is responsible for the menus attached to this terminal window.
 TerminalOption[] getOptions()
          Get the terminal options.
 java.awt.Container getPanelWithScrollbar()
          Return the panel containing the actual terminal window, including the scrollbar.
 java.util.Properties getProperties()
          Get the current terminal properties
 java.lang.String getProperty(java.lang.String key)
          Get the value of a single property.
static java.lang.String[] getPropertyNames()
          Get the name of all properties the terminal emulator cares about.
 boolean getPropsChanged()
          Check if any properties have changed.
 java.lang.String getSelection()
          Get the current selection.
static java.awt.Color getTermColor(java.lang.String name)
          Get a predefined terminal color.
static java.lang.String[] getTerminalTypes()
          Get a list of terminal types this terminal can emulate.
static java.awt.Color getTermRGBColor(java.lang.String value)
          Get a color as specified by an R,G,B tuple.
 java.lang.String getTitle()
          Get the title
 void hideLogo()
          Hide the logo, that is do not show it.
 int hpixels()
          Get the number of horizontal pixels used to represent the terminal.
static boolean isProperty(java.lang.String key)
          Check if the passed property name is a valid property for this terminal window.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(int visTop, int row, int col, int modifier, int which)
          Handle a mouse click event
 void mouseDragged(int visTop, int mouseRow, int mouseCol, int modifier, int which, int delta)
          Handle a mouse dragged event
 void mousePressed(int visTop, int mouseRow, int mouseCol, int modifier, int which, int x, int y)
          Handle a mouse press event
 void mouseReleased(int visTop, int mouseRow, int mouseCol, int modifier, int which)
          Handle a mouse release event
 void printScreen()
          Dump the current screen to the attached printer.
 void removeInputListener(TerminalInputListener inListener)
          Removes a previously added input listener
 void removeOutputListener(TerminalOutputListener outListener)
          Removes a previously added output listener
 void requestFocus()
          Causes the terminal emulator to request the focus.
 void reset()
          Reset the terminal emulator to the default state.
 void resetProperty(java.lang.String key)
          Reset a property back to its default value.
 void resetToDefaults()
          Reset all properties to their default values.
 void ringBell()
          This shortcut method rings the terminal bell.
 int rows()
          Get the number of rows shown.
 void scrollDown()
           
 void scrollUp()
           
 SearchContext search(SearchContext lastContext, java.lang.String key, boolean reverse, boolean caseSens)
          Search for a string in the terminal window
 void selectAll()
          Select all text
 void sendBreak()
          Send a break singal to the server.
 void sendBytes(byte[] b)
          May be called when the user pastes data.
 void sendBytesInt(byte[] b)
           
 void sendString(java.lang.String s)
          Simulate key events, just send the specified charascters
 void setAttributeBold(boolean set)
          This shortcut menthod is used to enable/disable bold characters.
 void setClipboard(TerminalClipboardHandler clipboard)
          Set the clipboard handler to use in this terminal window.
 void setCursorPos(int row, int col)
          This shortcut method moves the cursor to the given position.
 void setDumbMode(boolean dumb)
          Enable/disable dumb mode.
 void setFont(java.awt.Font font)
          Set the font to use.
 void setFont(java.lang.String name, int size)
          Set the font to use.
 void setGeometry(java.lang.String geometry)
          Set the geometry to use, The geometry is a string which looks something like 80x24+23+42 which creates a window which is 80 columns with 24 rows and which is placed at x=23,y=24.
 void setIgnoreClose()
          Set the frame to ignore window close events.
 void setInputCharset(java.lang.String charset)
          Set the charset used to input text.
 void setLogo(java.awt.Image logoImg, int x, int y, int w, int h)
          Set the logo to show on the login screen.
 void setMenus(TerminalMenuHandler menus)
          Set the menu handler
 void setPopupButton(int buttonNum)
          Set which mouse button should cause the popup menu to appear.
 void setProperties(java.util.Properties newProps, boolean merge)
          Set a bunch of terminal properties
 void setProperty(java.lang.String key, java.lang.String value)
          Set a single terminal property.
 void setProperty(java.lang.String key, java.lang.String value, boolean forceSet)
          Set a property.
 void setPropsChanged(boolean value)
          Change the properties changed flag.
 void setTitle(java.lang.String title)
          Set title of terminal window.
 boolean showLogo()
          Show the logo on the terminal.
 void signalWindowChanged(int rows, int cols, int vpixels, int hpixels)
          Tell all our input listeners that the terminal size has changed.
 void startPrinter()
          Start dumping a log of everything which is printed on the terminal to the attached printer.
 void stopPrinter()
          Stop printing.
 java.lang.String terminalType()
          Get the terminal type which the window currently emulates.
 void typedChar(char c)
          Called whn the user tpyes a character
 void typedCharInt(byte[] b)
           
 void typedCharInt(char c)
           
 void updateMenus()
          Called when the menus should be updated.
 int vpixels()
          Get the number of vertical pixels used to represent the terminal.
 void windowClosed(java.awt.event.WindowEvent e)
          This is notified when the window is closed and is used to tell the display class to kill the repainter thread.
 void write(byte b)
          Write a byte to the terminal.
 void write(byte[] c, int off, int len)
          Write a bunch of bytes to the terminal.
 void write(char c)
          Write a character to the terminal.
 void write(char[] c, int off, int len)
          Write a bunch of characters to the terminal.
 void write(java.lang.String s)
          Write a string to the terminal.
 
Methods inherited from class java.awt.event.WindowAdapter
windowActivated, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

termColors

public static final java.awt.Color[] termColors
Predefined colors


termColorNames

public static final java.lang.String[] termColorNames
The names of the predefined colors


LEFT_BUTTON

public static final int LEFT_BUTTON
See Also:
Constant Field Values

MIDDLE_BUTTON

public static final int MIDDLE_BUTTON
See Also:
Constant Field Values

RIGHT_BUTTON

public static final int RIGHT_BUTTON
See Also:
Constant Field Values

UNKNOWN_BUTTON

public static final int UNKNOWN_BUTTON
See Also:
Constant Field Values
Constructor Detail

TerminalWin

public TerminalWin(java.awt.Frame ownerFrame)
            throws java.lang.IllegalArgumentException,
                   java.util.NoSuchElementException
Create a new terminal window with the default values of all properties. The window will use AWT or Swing widgets depending on if the owner frame is a Frame or .

Parameters:
ownerFrame - frame used to determine if AWT or Swing should be used.

TerminalWin

public TerminalWin(java.awt.Frame ownerFrame,
                   java.util.Properties initProps)
            throws java.lang.IllegalArgumentException
Create a new terminal window with the given properties. The window will use AWT or Swing widgets depending on if the owner frame is a Frame or .

Parameters:
ownerFrame - frame used to determine if AWT or Swing should be used.
initProps - initial properties

TerminalWin

public TerminalWin(java.awt.Frame ownerFrame,
                   java.util.Properties initProps,
                   boolean setAsDefault)
            throws java.lang.IllegalArgumentException
Create a new terminal window with the given properties. The window will use AWT or Swing widgets depending on if the owner frame is a Frame or .

Parameters:
ownerFrame - frame used to determine if AWT or Swing should be used.
initProps - initial properties
setAsDefault - mark these properties as default and use them if no others are specified in the future.
Method Detail

getTerminalTypes

public static java.lang.String[] getTerminalTypes()
Get a list of terminal types this terminal can emulate.

Returns:
an array of terminal type names

emulateComponentShown

public void emulateComponentShown()
Generate a syntetic ComponentShown event.


requestFocus

public void requestFocus()
Causes the terminal emulator to request the focus.


setMenus

public void setMenus(TerminalMenuHandler menus)
Set the menu handler


getMenus

public TerminalMenuHandler getMenus()
Return the menu handler which is responsible for the menus attached to this terminal window.

Returns:
the menu handler

getDisplay

public DisplayView getDisplay()
Return the current display view object which handles the actual displaying of data in the terminal window.


updateMenus

public void updateMenus()
Called when the menus should be updated.


setLogo

public void setLogo(java.awt.Image logoImg,
                    int x,
                    int y,
                    int w,
                    int h)
Set the logo to show on the login screen.

Parameters:
logoImg - the actual logo
x - x position to show it at
y - y position to show it on
w - width of logo when shown
h - height of logo when shown

getLogo

public java.awt.Image getLogo()
Get the logo image.

Returns:
the logo image

showLogo

public boolean showLogo()
Show the logo on the terminal.


hideLogo

public void hideLogo()
Hide the logo, that is do not show it.


setProperties

public void setProperties(java.util.Properties newProps,
                          boolean merge)
                   throws java.lang.IllegalArgumentException
Description copied from interface: TerminalWindow
Set a bunch of terminal properties

Specified by:
setProperties in interface TerminalWindow
Parameters:
newProps - new properties
merge - if true the new properties are merged with any previous properties. If false all old properties are deleted.
Throws:
java.lang.IllegalArgumentException

getProperties

public java.util.Properties getProperties()
Description copied from interface: TerminalWindow
Get the current terminal properties

Specified by:
getProperties in interface TerminalWindow
Returns:
the current properties

getPropsChanged

public boolean getPropsChanged()
Description copied from interface: TerminalWindow
Check if any properties have changed.

Specified by:
getPropsChanged in interface TerminalWindow
Returns:
true if any properties has changed

setPropsChanged

public void setPropsChanged(boolean value)
Description copied from interface: TerminalWindow
Change the properties changed flag.

Specified by:
setPropsChanged in interface TerminalWindow
Parameters:
value - new value.

isProperty

public static boolean isProperty(java.lang.String key)
Check if the passed property name is a valid property for this terminal window.

Parameters:
key - a property name
Returns:
true if this is a terminal property

resetToDefaults

public void resetToDefaults()
Description copied from interface: TerminalWindow
Reset all properties to their default values.

Specified by:
resetToDefaults in interface TerminalWindow

getPropertyNames

public static java.lang.String[] getPropertyNames()
Get the name of all properties the terminal emulator cares about.

Returns:
an array of property names

getProperty

public java.lang.String getProperty(java.lang.String key)
Description copied from interface: TerminalWindow
Get the value of a single property.

Specified by:
getProperty in interface TerminalWindow
Parameters:
key - name of perty to get value of
Returns:
the value of the property. Null if the peroperty is not defined and there is no default value.

getDefaultProperty

public java.lang.String getDefaultProperty(java.lang.String key)
Get the default value of the given property.

Parameters:
key - name of peroperty
Returns:
the value

resetProperty

public void resetProperty(java.lang.String key)
Reset a property back to its default value.

Parameters:
key - name of property to reset

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
                 throws java.lang.IllegalArgumentException,
                        java.util.NoSuchElementException
Description copied from interface: TerminalWindow
Set a single terminal property.

Specified by:
setProperty in interface TerminalWindow
Parameters:
key - property to set
value - value to set it to
Throws:
java.lang.IllegalArgumentException
java.util.NoSuchElementException

getOptions

public TerminalOption[] getOptions()
Description copied from interface: TerminalWindow
Get the terminal options.

Specified by:
getOptions in interface TerminalWindow

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value,
                        boolean forceSet)
                 throws java.lang.IllegalArgumentException,
                        java.util.NoSuchElementException
Set a property.

Parameters:
key - name of property
value - value of property
forceSet - if true then the property os set event if the key is not a valid terminal property name
Throws:
java.lang.IllegalArgumentException
java.util.NoSuchElementException

getTermRGBColor

public static java.awt.Color getTermRGBColor(java.lang.String value)
                                      throws java.lang.NumberFormatException
Get a color as specified by an R,G,B tuple.

Parameters:
value - a string with the R,G,B value of the form 0,0,0. Legal values for each element are 0-255.
Throws:
java.lang.NumberFormatException

getTermColor

public static java.awt.Color getTermColor(java.lang.String name)
                                   throws java.lang.IllegalArgumentException
Get a predefined terminal color.

Parameters:
name - name of desired color
Throws:
java.lang.IllegalArgumentException

setGeometry

public void setGeometry(java.lang.String geometry)
                 throws java.lang.IllegalArgumentException
Set the geometry to use, The geometry is a string which looks something like 80x24+23+42 which creates a window which is 80 columns with 24 rows and which is placed at x=23,y=24. It is also possible to just specify the size or the position and any of the position values can be preceded by a minus sign in which case it is countyed from the right/bottom edge instead.

Parameters:
geometry - string representing the geometry
Throws:
java.lang.IllegalArgumentException

setFont

public void setFont(java.lang.String name,
                    int size)
Set the font to use. The font should be a fixed-width font or the terminal may behave strangely.

Parameters:
name - name of font
size - size of font

setFont

public void setFont(java.awt.Font font)
Set the font to use. The font should be a fixed-width font or the terminal may behave strangely.

Parameters:
font - font to use

setTitle

public void setTitle(java.lang.String title)
Description copied from interface: TerminalWindow
Set title of terminal window.

Specified by:
setTitle in interface TerminalWindow
Parameters:
title - the title

getTitle

public java.lang.String getTitle()
Description copied from interface: TerminalWindow
Get the title

Specified by:
getTitle in interface TerminalWindow
Returns:
the title of the terminal window

setPopupButton

public void setPopupButton(int buttonNum)
Set which mouse button should cause the popup menu to appear.

Parameters:
buttonNum - button number. One of InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK or InputEvent.BUTTON3_MASK

getPanelWithScrollbar

public java.awt.Container getPanelWithScrollbar()
Return the panel containing the actual terminal window, including the scrollbar.


clearSaveLines

public void clearSaveLines()
Forgets any saved lines in the scrollback buffer.


setInputCharset

public void setInputCharset(java.lang.String charset)
                     throws java.lang.IllegalArgumentException
Set the charset used to input text.

Throws:
java.lang.IllegalArgumentException

terminalType

public java.lang.String terminalType()
Description copied from interface: TerminalWindow
Get the terminal type which the window currently emulates.

Specified by:
terminalType in interface TerminalWindow
Returns:
the name of the emulated terminal

rows

public int rows()
Description copied from interface: TerminalWindow
Get the number of rows shown.

Specified by:
rows in interface TerminalWindow
Returns:
the number of rows

cols

public int cols()
Description copied from interface: TerminalWindow
Get the number of columns shown.

Specified by:
cols in interface TerminalWindow
Returns:
the number of columns

vpixels

public int vpixels()
Description copied from interface: TerminalWindow
Get the number of vertical pixels used to represent the terminal.

Specified by:
vpixels in interface TerminalWindow
Returns:
the number of vertical pixels

hpixels

public int hpixels()
Description copied from interface: TerminalWindow
Get the number of horizontal pixels used to represent the terminal.

Specified by:
hpixels in interface TerminalWindow
Returns:
the number of horizontal pixels

write

public void write(byte b)
Description copied from interface: TerminalWindow
Write a byte to the terminal. The byte will be assumed to be in the current remote encoding.

Specified by:
write in interface TerminalWindow
Parameters:
b - byte to write

write

public void write(char c)
Description copied from interface: TerminalWindow
Write a character to the terminal.

The character is assumed to be in the java internal encoding.

Specified by:
write in interface TerminalWindow
Parameters:
c - character to write

write

public void write(char[] c,
                  int off,
                  int len)
Description copied from interface: TerminalWindow
Write a bunch of characters to the terminal.

The characters are assumed to be in the java internal encoding.

Specified by:
write in interface TerminalWindow
Parameters:
c - array containg the characters to write
off - index in array of first character to write
len - number of characters to write

write

public void write(byte[] c,
                  int off,
                  int len)
Description copied from interface: TerminalWindow
Write a bunch of bytes to the terminal. The bytes will be assumed to be in the current remote encoding.

Specified by:
write in interface TerminalWindow
Parameters:
c - array containg the characters to write
off - index in array of first character to write
len - number of characters to write

write

public void write(java.lang.String s)
Description copied from interface: TerminalWindow
Write a string to the terminal. The string is assumed to be in the java internal encoding.

Specified by:
write in interface TerminalWindow
Parameters:
s - string to write

addInputListener

public void addInputListener(TerminalInputListener inListener)
Description copied from interface: TerminalWindow
Add a input listener which listens to data from the user.

Specified by:
addInputListener in interface TerminalWindow
Parameters:
inListener - input listener to add

removeInputListener

public void removeInputListener(TerminalInputListener inListener)
Description copied from interface: TerminalWindow
Removes a previously added input listener

Specified by:
removeInputListener in interface TerminalWindow
Parameters:
inListener - input listener to remove

addOutputListener

public void addOutputListener(TerminalOutputListener outListener)
Description copied from interface: TerminalWindow
Add a output listener which listens to data from the server.

Specified by:
addOutputListener in interface TerminalWindow
Parameters:
outListener - output listener to add

removeOutputListener

public void removeOutputListener(TerminalOutputListener outListener)
Description copied from interface: TerminalWindow
Removes a previously added output listener

Specified by:
removeOutputListener in interface TerminalWindow
Parameters:
outListener - output listener to remove

attachPrinter

public void attachPrinter(TerminalPrinter printer)
Description copied from interface: TerminalWindow
Attach a printer to this terminal.

Specified by:
attachPrinter in interface TerminalWindow
Parameters:
printer - printer to attach

detachPrinter

public void detachPrinter()
Description copied from interface: TerminalWindow
Detach the previously attached printer.

Specified by:
detachPrinter in interface TerminalWindow

setClipboard

public void setClipboard(TerminalClipboardHandler clipboard)
Set the clipboard handler to use in this terminal window.

Parameters:
clipboard - clipboard handler to use

getClipboard

public TerminalClipboardHandler getClipboard()
Get the clipboard used.

Returns:
the current clipboard

typedChar

public void typedChar(char c)
Description copied from interface: TerminalWindow
Called whn the user tpyes a character

Specified by:
typedChar in interface TerminalWindow
Parameters:
c - typed character

typedCharInt

public void typedCharInt(char c)

typedCharInt

public void typedCharInt(byte[] b)

sendBytes

public final void sendBytes(byte[] b)
Description copied from interface: TerminalWindow
May be called when the user pastes data. It may also be called by some external entity whishing to simulate multiple key presses.

Specified by:
sendBytes in interface TerminalWindow
Parameters:
b - array of bytes representing characters to input

sendBytesInt

public final void sendBytesInt(byte[] b)

sendBreak

public final void sendBreak()
Description copied from interface: TerminalWindow
Send a break singal to the server.

Specified by:
sendBreak in interface TerminalWindow

signalWindowChanged

public void signalWindowChanged(int rows,
                                int cols,
                                int vpixels,
                                int hpixels)
Tell all our input listeners that the terminal size has changed.

Parameters:
rows - new number of rows
cols - new number of columns
vpixels - new number of vertical pixels
hpixels - new number of horizontal pixels

reset

public void reset()
Description copied from interface: TerminalWindow
Reset the terminal emulator to the default state.

Specified by:
reset in interface TerminalWindow

printScreen

public void printScreen()
Description copied from interface: TerminalWindow
Dump the current screen to the attached printer.

Specified by:
printScreen in interface TerminalWindow

startPrinter

public void startPrinter()
Description copied from interface: TerminalWindow
Start dumping a log of everything which is printed on the terminal to the attached printer.

Specified by:
startPrinter in interface TerminalWindow

stopPrinter

public void stopPrinter()
Description copied from interface: TerminalWindow
Stop printing.

Specified by:
stopPrinter in interface TerminalWindow

search

public SearchContext search(SearchContext lastContext,
                            java.lang.String key,
                            boolean reverse,
                            boolean caseSens)
Description copied from interface: TerminalWindow
Search for a string in the terminal window

Specified by:
search in interface TerminalWindow
Parameters:
lastContext - used as a starying point, if not null, so tha the search may continue from the last position
key - string to search for
reverse - if true the search is performed backwards
caseSens - if true the key is case sensitive
Returns:
a search context which describes where the key was found or null if the key was not found.

displayDragResize

public void displayDragResize(int newRows,
                              int newCols)
Resize the terminal during a drag operation. That is the size is changed but the server is not notified.

Specified by:
displayDragResize in interface com.mindbright.terminal.DisplayController
Parameters:
newRows - new number of rows
newCols - new number of columns

displayResized

public void displayResized(int newRows,
                           int newCols,
                           int vpixels,
                           int hpixels)
Claled when the terminal window has been resized. This will cause the server to be notified of the new size.

Specified by:
displayResized in interface com.mindbright.terminal.DisplayController
Parameters:
newRows - new number of rows
newCols - new number of columns
vpixels - vertical pixesl
hpixels - horizontal pixesl

selectAll

public void selectAll()
Select all text


clearSelection

public void clearSelection()
Removes the selection if there is one.


getSelection

public java.lang.String getSelection()
Get the current selection.

Returns:
the current selection

doCopy

public void doCopy()
Store a copy of the selection in the clipboard.


doPaste

public void doPaste()
Paset the contents of the clipboard.


setDumbMode

public void setDumbMode(boolean dumb)
Enable/disable dumb mode. In dumb mode none of the cursor keys work. This is needed when the user is prompted for a line of input.

Parameters:
dumb - true if dumb mode should be enabled.

setIgnoreClose

public void setIgnoreClose()
Set the frame to ignore window close events.


mouseClicked

public void mouseClicked(int visTop,
                         int row,
                         int col,
                         int modifier,
                         int which)
Handle a mouse click event

Specified by:
mouseClicked in interface com.mindbright.terminal.DisplayController
Parameters:
visTop - index of top visual line
row - row of character the mouse was pointing at
col - column of character the mouse was pointing at
modifier - modifiers active

mousePressed

public void mousePressed(int visTop,
                         int mouseRow,
                         int mouseCol,
                         int modifier,
                         int which,
                         int x,
                         int y)
Handle a mouse press event

Specified by:
mousePressed in interface com.mindbright.terminal.DisplayController
Parameters:
visTop - index of top visual line
mouseRow - row of character the mouse was pointing at
mouseCol - column of character the mouse was pointing at
modifier - modifiers active
x - x coordinate of mouse
y - y coordinate of mouse

mouseReleased

public void mouseReleased(int visTop,
                          int mouseRow,
                          int mouseCol,
                          int modifier,
                          int which)
Handle a mouse release event

Specified by:
mouseReleased in interface com.mindbright.terminal.DisplayController
Parameters:
visTop - index of top visual line
mouseRow - row of character the mouse was pointing at
mouseCol - column of character the mouse was pointing at
modifier - modifiers active

mouseDragged

public void mouseDragged(int visTop,
                         int mouseRow,
                         int mouseCol,
                         int modifier,
                         int which,
                         int delta)
Handle a mouse dragged event

Specified by:
mouseDragged in interface com.mindbright.terminal.DisplayController
Parameters:
visTop - index of top visual line
mouseRow - row of character the mouse was pointing at
mouseCol - column of character the mouse was pointing at
modifier - modifiers active

scrollUp

public void scrollUp()
Specified by:
scrollUp in interface com.mindbright.terminal.DisplayController

scrollDown

public void scrollDown()
Specified by:
scrollDown in interface com.mindbright.terminal.DisplayController

sendString

public void sendString(java.lang.String s)
Simulate key events, just send the specified charascters


addAsEntropyGenerator

public void addAsEntropyGenerator(RandomSeed seed)
Description copied from interface: TerminalWindow
Casuses this terminal window to send events to the specified random seed in order to extract entropy from them

Specified by:
addAsEntropyGenerator in interface TerminalWindow
Parameters:
seed - the random seed to send entropy to

setAttributeBold

public void setAttributeBold(boolean set)
Description copied from interface: TerminalWindow
This shortcut menthod is used to enable/disable bold characters.

The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

Specified by:
setAttributeBold in interface TerminalWindow
Parameters:
set - if true turn on bold for subsequent characters.

clearScreen

public void clearScreen()
Description copied from interface: TerminalWindow
This shortcut method clears the screen.

The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

Specified by:
clearScreen in interface TerminalWindow

ringBell

public void ringBell()
Description copied from interface: TerminalWindow
This shortcut method rings the terminal bell.

The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

Specified by:
ringBell in interface TerminalWindow

setCursorPos

public void setCursorPos(int row,
                         int col)
Description copied from interface: TerminalWindow
This shortcut method moves the cursor to the given position.

The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

Specified by:
setCursorPos in interface TerminalWindow
Parameters:
row - row to place cursor on
col - column to place cursor on

clearLine

public void clearLine()
Description copied from interface: TerminalWindow
This shortcut method clears the current line.

The shortcut methods are used by local code to achieve certain effects without knowing which terminal emulation is active.

Specified by:
clearLine in interface TerminalWindow

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
This is notified when the window is closed and is used to tell the display class to kill the repainter thread.

Specified by:
windowClosed in interface java.awt.event.WindowListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener