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.
-
bgColor
- The background color
-
cursorX
- The X index of the cursor (index of the current String element in the array)
-
cursorY
- The Y index of the cursor (index in the array of Strings)
-
drawCursor
- This flag tells the JerminalWindow whether to draw a cursor
-
exitOnClose
- This flag tells the Jerminal window whether to exit the JerminalSession if a close window event is recieved.
-
fgColor
- The foreground color
-
fixedFontHeight
- The number of pixels high the current font takes up
-
fixedFontWidth
- The number of pixels wide the current font takes up
-
font
- The font in which the text is drawn
-
height
- The height of the window in pixels
-
jerminal
- The JerminalSession associated with this Window (this can be left null)
-
jerminalIn
- The JerminalSession input stream associated with this Window (this can be left null)
-
jerminalOut
- The JerminalSession output stream associated with this Window (this can be left null)
-
keyListener
- The key listener that will listen to keyboard input for this window
-
props
- The runtime properties for the JerminalWindow
-
scrollIndex
- When scrolling, this is how far from the end of the array is being drawn
-
scrolling
- This flag is set to true when the JerminalWindow is currently scrolling through previously undrawn String array elements
-
tabWidth
- This is the width of a tab in characters
-
text
- This is the array that the text in this window is stored in.
-
width
- The width of the window in pixels
-
xCharOffset
- The number of pixels to buffer the left and right edge of the window
-
xoffset
- The X offset (in pixels) of where the text is to be drawn
-
yCharOffset
- The number of pixels to buffer the top and bottom edge of the window
-
yoffset
- The Y offset (in pixels) of where the text is to be drawn
-
JerminalWindow(Props)
- Initialize window and local variables.
-
componentHidden(ComponentEvent)
- ComponentListener methods
-
componentMoved(ComponentEvent)
-
-
componentResized(ComponentEvent)
-
-
componentShown(ComponentEvent)
-
-
dispose()
- This closes the window and releases used resources (but doesn't necessarily dispose of them).
-
error(String)
-
-
error(String, Exception)
-
-
getMaxCharHeight(int)
- This method returns the maximum number of characters that will fit vertically across
the current window based on the given font height.
-
getMaxCharWidth(int)
- This method returns the maximum number of characters that will fit horizontally across
the current window based on the given font advance.
-
init()
- Init runtime variables
-
initProps()
- Initialize defaults for Props and set local props dependant variables
-
insertAtCursor(char)
- This method inserts the character into the String array at the cursor.
-
insertAtCursor(String)
- This method inserts the String into the String array at the cursor.
-
insertTab()
- This method inserts a tab in the String array at the cursor.
-
main(String[])
-
-
makeNewLine()
- This method inserts a new String (new line) at the Y cursor.
-
moveCursor(int, int)
- This method moves the cursor to the given coordinates.
-
moveCursorX(int)
- This method offsets the X cursor xdiff number of characters.
-
moveCursorY(int)
- This method offsets the Y cursor xdiff number of array elements.
-
overwriteAtCursor(char)
- This method replaces the character at the cursor with the character passed in as a parameter.
-
overwriteAtCursor(String)
- This method replaces the text at the cursor with the String passed in as a parameter.
-
paint(Graphics)
- This method draws the Strings in the String array text[].
-
print(String)
-
-
refresh(boolean)
- This forces the window to repaint itself.
-
scrollDown()
- This method causes the window to scroll down, thus viewing Strings of a higher array index.
-
scrollUp()
- This method causes the window to scroll up, thus viewing Strings of a lower array index.
-
visualBeep()
- This method causes the window to flash, indicating a 'beep'.
-
windowActivated(WindowEvent)
- WindowListener methods
-
windowClosed(WindowEvent)
-
-
windowClosing(WindowEvent)
-
-
windowDeactivated(WindowEvent)
-
-
windowDeiconified(WindowEvent)
-
-
windowIconified(WindowEvent)
-
-
windowOpened(WindowEvent)
-
bgColor
public Color bgColor
- The background color
fgColor
public Color fgColor
- The foreground color
width
public int width
- The width of the window in pixels
height
public int height
- The height of the window in pixels
xoffset
public int xoffset
- The X offset (in pixels) of where the text is to be drawn
yoffset
public int yoffset
- The Y offset (in pixels) of where the text is to be drawn
xCharOffset
public int xCharOffset
- The number of pixels to buffer the left and right edge of the window
yCharOffset
public int yCharOffset
- The number of pixels to buffer the top and bottom edge of the window
font
public Font font
- The font in which the text is drawn
cursorX
public int cursorX
- The X index of the cursor (index of the current String element in the array)
cursorY
public int cursorY
- The Y index of the cursor (index in the array of Strings)
fixedFontWidth
public int fixedFontWidth
- The number of pixels wide the current font takes up
fixedFontHeight
public int fixedFontHeight
- The number of pixels high the current font takes up
jerminal
public JerminalSession jerminal
- The JerminalSession associated with this Window (this can be left null)
jerminalIn
public InputStream jerminalIn
- The JerminalSession input stream associated with this Window (this can be left null)
jerminalOut
public OutputStream jerminalOut
- The JerminalSession output stream associated with this Window (this can be left null)
drawCursor
public boolean drawCursor
- This flag tells the JerminalWindow whether to draw a cursor
keyListener
public JerminalKeyListener keyListener
- The key listener that will listen to keyboard input for this window
props
public Props props
- The runtime properties for the JerminalWindow
exitOnClose
public boolean exitOnClose
- This flag tells the Jerminal window whether to exit the JerminalSession if a close window event is recieved.
tabWidth
public int tabWidth
- This is the width of a tab in characters
scrolling
public boolean scrolling
- This flag is set to true when the JerminalWindow is currently scrolling through previously undrawn String array elements
scrollIndex
public int scrollIndex
- When scrolling, this is how far from the end of the array is being drawn
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
JerminalWindow
public JerminalWindow(Props p)
- Initialize window and local variables.
initProps
public void initProps()
- Initialize defaults for Props and set local props dependant variables
init
public void init()
- Init runtime variables
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.
insertAtCursor
public void insertAtCursor(String s)
- This method inserts the String into the String array at the cursor.
insertAtCursor
public void insertAtCursor(char c)
- This method inserts the character into the String array at the cursor.
overwriteAtCursor
public void overwriteAtCursor(String s)
- This method replaces the text at the cursor with the String passed in as a parameter.
overwriteAtCursor
public void overwriteAtCursor(char c)
- This method replaces the character at the cursor with the character passed in as a parameter.
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.
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.
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.
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.
visualBeep
public void visualBeep()
- This method causes the window to flash, indicating a 'beep'.
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.
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.
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.
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.
windowActivated
public void windowActivated(WindowEvent event)
- WindowListener methods
windowClosed
public void windowClosed(WindowEvent event)
windowClosing
public void windowClosing(WindowEvent event)
windowDeactivated
public void windowDeactivated(WindowEvent event)
windowDeiconified
public void windowDeiconified(WindowEvent event)
windowIconified
public void windowIconified(WindowEvent event)
windowOpened
public void windowOpened(WindowEvent event)
componentHidden
public void componentHidden(ComponentEvent event)
- ComponentListener methods
componentMoved
public void componentMoved(ComponentEvent event)
componentShown
public void componentShown(ComponentEvent event)
componentResized
public void componentResized(ComponentEvent event)
dispose
public void dispose()
- This closes the window and releases used resources (but doesn't necessarily dispose of them).
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.
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.
print
public void print(String s)
error
public void error(String s)
error
public void error(String s,
Exception e)
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index