All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.cometway.jerminal.JerminalWindow

com.cometway.jerminal.JerminalWindow

public class JerminalWindow
This subclass of java.awt.Frame supports a Text terminal and many features that windowed text terminals have. This window has an array of Strings which it paints in the window starting from the bottom of the window and the end of the array. Lines that are longer than the window width are automatically wrapped, thus reducing the total number of Strings in the array which can be drawn. This window also keeps track of a cursor and provides a number of methods which allow insertion of text at the cursor. There is also functionality to allow scrolling through the rest of the Strings in the array which are not drawn in the window.


Variable Index

 o bgColor
The background color
 o cursorX
The X index of the cursor (index of the current String element in the array)
 o cursorY
The Y index of the cursor (index in the array of Strings)
 o drawCursor
This flag tells the JerminalWindow whether to draw a cursor
 o exitOnClose
This flag tells the Jerminal window whether to exit the JerminalSession if a close window event is recieved.
 o fgColor
The foreground color
 o fixedFontHeight
The number of pixels high the current font takes up
 o fixedFontWidth
The number of pixels wide the current font takes up
 o font
The font in which the text is drawn
 o height
The height of the window in pixels
 o jerminal
The JerminalSession associated with this Window (this can be left null)
 o jerminalIn
The JerminalSession input stream associated with this Window (this can be left null)
 o jerminalOut
The JerminalSession output stream associated with this Window (this can be left null)
 o keyListener
The key listener that will listen to keyboard input for this window
 o props
The runtime properties for the JerminalWindow
 o scrollIndex
When scrolling, this is how far from the end of the array is being drawn
 o scrolling
This flag is set to true when the JerminalWindow is currently scrolling through previously undrawn String array elements
 o tabWidth
This is the width of a tab in characters
 o text
This is the array that the text in this window is stored in.
 o width
The width of the window in pixels
 o xCharOffset
The number of pixels to buffer the left and right edge of the window
 o xoffset
The X offset (in pixels) of where the text is to be drawn
 o yCharOffset
The number of pixels to buffer the top and bottom edge of the window
 o yoffset
The Y offset (in pixels) of where the text is to be drawn

Constructor Index

 o JerminalWindow(Props)
Initialize window and local variables.

Method Index

 o componentHidden(ComponentEvent)
ComponentListener methods
 o componentMoved(ComponentEvent)
 o componentResized(ComponentEvent)
 o componentShown(ComponentEvent)
 o dispose()
This closes the window and releases used resources (but doesn't necessarily dispose of them).
 o error(String)
 o error(String, Exception)
 o getMaxCharHeight(int)
This method returns the maximum number of characters that will fit vertically across the current window based on the given font height.
 o getMaxCharWidth(int)
This method returns the maximum number of characters that will fit horizontally across the current window based on the given font advance.
 o init()
Init runtime variables
 o initProps()
Initialize defaults for Props and set local props dependant variables
 o insertAtCursor(char)
This method inserts the character into the String array at the cursor.
 o insertAtCursor(String)
This method inserts the String into the String array at the cursor.
 o insertTab()
This method inserts a tab in the String array at the cursor.
 o main(String[])
 o makeNewLine()
This method inserts a new String (new line) at the Y cursor.
 o moveCursor(int, int)
This method moves the cursor to the given coordinates.
 o moveCursorX(int)
This method offsets the X cursor xdiff number of characters.
 o moveCursorY(int)
This method offsets the Y cursor xdiff number of array elements.
 o overwriteAtCursor(char)
This method replaces the character at the cursor with the character passed in as a parameter.
 o overwriteAtCursor(String)
This method replaces the text at the cursor with the String passed in as a parameter.
 o paint(Graphics)
This method draws the Strings in the String array text[].
 o print(String)
 o refresh(boolean)
This forces the window to repaint itself.
 o scrollDown()
This method causes the window to scroll down, thus viewing Strings of a higher array index.
 o scrollUp()
This method causes the window to scroll up, thus viewing Strings of a lower array index.
 o visualBeep()
This method causes the window to flash, indicating a 'beep'.
 o windowActivated(WindowEvent)
WindowListener methods
 o windowClosed(WindowEvent)
 o windowClosing(WindowEvent)
 o windowDeactivated(WindowEvent)
 o windowDeiconified(WindowEvent)
 o windowIconified(WindowEvent)
 o windowOpened(WindowEvent)

Variables

 o bgColor
 public Color bgColor
The background color

 o fgColor
 public Color fgColor
The foreground color

 o width
 public int width
The width of the window in pixels

 o height
 public int height
The height of the window in pixels

 o xoffset
 public int xoffset
The X offset (in pixels) of where the text is to be drawn

 o yoffset
 public int yoffset
The Y offset (in pixels) of where the text is to be drawn

 o xCharOffset
 public int xCharOffset
The number of pixels to buffer the left and right edge of the window

 o yCharOffset
 public int yCharOffset
The number of pixels to buffer the top and bottom edge of the window

 o font
 public Font font
The font in which the text is drawn

 o cursorX
 public int cursorX
The X index of the cursor (index of the current String element in the array)

 o cursorY
 public int cursorY
The Y index of the cursor (index in the array of Strings)

 o fixedFontWidth
 public int fixedFontWidth
The number of pixels wide the current font takes up

 o fixedFontHeight
 public int fixedFontHeight
The number of pixels high the current font takes up

 o jerminal
 public JerminalSession jerminal
The JerminalSession associated with this Window (this can be left null)

 o jerminalIn
 public InputStream jerminalIn
The JerminalSession input stream associated with this Window (this can be left null)

 o jerminalOut
 public OutputStream jerminalOut
The JerminalSession output stream associated with this Window (this can be left null)

 o drawCursor
 public boolean drawCursor
This flag tells the JerminalWindow whether to draw a cursor

 o keyListener
 public JerminalKeyListener keyListener
The key listener that will listen to keyboard input for this window

 o props
 public Props props
The runtime properties for the JerminalWindow

 o exitOnClose
 public boolean exitOnClose
This flag tells the Jerminal window whether to exit the JerminalSession if a close window event is recieved.

 o tabWidth
 public int tabWidth
This is the width of a tab in characters

 o scrolling
 public boolean scrolling
This flag is set to true when the JerminalWindow is currently scrolling through previously undrawn String array elements

 o scrollIndex
 public int scrollIndex
When scrolling, this is how far from the end of the array is being drawn

 o text
 public String text[]
This is the array that the text in this window is stored in. The paint() method draws the text in this array starting from the end of the array

Constructors

 o JerminalWindow
 public JerminalWindow(Props p)
Initialize window and local variables.

Methods

 o initProps
 public void initProps()
Initialize defaults for Props and set local props dependant variables

 o init
 public void init()
Init runtime variables

 o insertTab
 public void insertTab()
This method inserts a tab in the String array at the cursor. The length of the tab stop is given by the tabWidth field.

 o insertAtCursor
 public void insertAtCursor(String s)
This method inserts the String into the String array at the cursor.

 o insertAtCursor
 public void insertAtCursor(char c)
This method inserts the character into the String array at the cursor.

 o overwriteAtCursor
 public void overwriteAtCursor(String s)
This method replaces the text at the cursor with the String passed in as a parameter.

 o overwriteAtCursor
 public void overwriteAtCursor(char c)
This method replaces the character at the cursor with the character passed in as a parameter.

 o moveCursor
 public void moveCursor(int x,
                        int y)
This method moves the cursor to the given coordinates. If the Y cursor is out of the array bounds, it is moved back into the end/beginning of the array. Then if the X cursor is out of the String's bounds, it is moved to the end/beginning of the String.

 o moveCursorX
 public void moveCursorX(int xdiff)
This method offsets the X cursor xdiff number of characters. If it leaves the bounds of the String, it will be moved to the end/beginning of the String.

 o moveCursorY
 public void moveCursorY(int ydiff)
This method offsets the Y cursor xdiff number of array elements. If it leaves the bounds of the String array, it will be moved to the end/beginning of the array.

 o makeNewLine
 public void makeNewLine()
This method inserts a new String (new line) at the Y cursor. All the previous Strings from the Y cursor on are moved one less array index. The String at array index 0 is discarded.

 o visualBeep
 public void visualBeep()
This method causes the window to flash, indicating a 'beep'.

 o getMaxCharWidth
 public int getMaxCharWidth(int advance)
This method returns the maximum number of characters that will fit horizontally across the current window based on the given font advance.

 o getMaxCharHeight
 public int getMaxCharHeight(int fontheight)
This method returns the maximum number of characters that will fit vertically across the current window based on the given font height.

 o scrollDown
 public void scrollDown()
This method causes the window to scroll down, thus viewing Strings of a higher array index. If the String at the end of the array can already be viewed, nothing will happen. This only really does anything if you have scrolled up first.

 o scrollUp
 public void scrollUp()
This method causes the window to scroll up, thus viewing Strings of a lower array index. If the String at the beginning of the array can already be viewed, nothing will happend.

 o windowActivated
 public void windowActivated(WindowEvent event)
WindowListener methods

 o windowClosed
 public void windowClosed(WindowEvent event)
 o windowClosing
 public void windowClosing(WindowEvent event)
 o windowDeactivated
 public void windowDeactivated(WindowEvent event)
 o windowDeiconified
 public void windowDeiconified(WindowEvent event)
 o windowIconified
 public void windowIconified(WindowEvent event)
 o windowOpened
 public void windowOpened(WindowEvent event)
 o componentHidden
 public void componentHidden(ComponentEvent event)
ComponentListener methods

 o componentMoved
 public void componentMoved(ComponentEvent event)
 o componentShown
 public void componentShown(ComponentEvent event)
 o componentResized
 public void componentResized(ComponentEvent event)
 o dispose
 public void dispose()
This closes the window and releases used resources (but doesn't necessarily dispose of them).

 o refresh
 public void refresh(boolean refreshAll)
This forces the window to repaint itself. The boolean parameter tells the method whether it should redraw the entire window. If refreshAll is set to true, the entire window will be redrawn, if it is set to false, only the line that the cursor is on will be redrawn.

 o paint
 public void paint(Graphics g)
This method draws the Strings in the String array text[]. It starts at the bottom of the screen and starts with the last array element (unless the window is scrolling). It also draws the cursor. Lines that exceed the maximum number of characters that fit horizontally across the current window will be wrapped.

 o print
 public void print(String s)
 o error
 public void error(String s)
 o error
 public void error(String s,
                   Exception e)
 o main
 public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index