Package com.iizigo.term.internal
Class TerminalWindow
java.lang.Object
com.iizigo.term.internal.TerminalWindow
- All Implemented Interfaces:
Runnable
,EventListener
,DisposeListener
,FocusListener
,KeyListener
,MouseListener
,MouseMoveListener
,PaintListener
,SWTEventListener
public class TerminalWindow extends Object implements FocusListener, KeyListener, MouseListener, MouseMoveListener, PaintListener, DisposeListener, Runnable
This class creates and displays the terminal window inside a JComponent, typically a JFrame or JInternalFrame. It will create a status bar at the bottom, place the terminal window display on top and possibly with scroll bars around.
This class is used by the Clients, but also by the terminal window on the Server when running in GUI mode.
Constructor Summary
ConstructorDescriptionTerminalWindow
(Canvas canvas, TerminalStatusBar statusBar, IScreenDesigner designer, int cx, int cy, int x, int y, char[] cd, int[] ad, TerminalWindowListener listener, TerminalSettings settings) The constructor creates the child components (terminal display with possible scroll bars and the status bar.Method Summary
Modifier and TypeMethodDescriptionvoid
addMark
(int x, int y, int cx, int cy) Adds a mark.void
Adds a mark.computeSize
(int wHint, int hHint) Gets the minimum size without scroll bars.void
Key pressed.void
Key released.void
Mouse double-click, continued.void
Mouse pressed.void
Mouse released, continued.void
Focus gained.void
Focus is lost.Gets the current pointer position relative canvas.Gets the current point of the cursor relative the "frame".int
Gets the font height.Gets the font name used.int
Gets the font width.int
Gets the left margin.getMarks()
Get the current selected marks.int
Gets the screenHeight.int
Gets the screenWidth.int
Gets the top margin.boolean
hasMark()
Get the current selected mark.boolean
Check for a single mark.void
Key pressed.void
Key released.void
Mouse double-click.void
Mouse pressed.void
Mouse move.void
Mouse released.void
onNewSize
(int cx, int cy) Called when a new size is set.void
The paint listener.boolean
removeMark
(int x, int y, int cx, int cy) Removes a mark.void
repaint()
Repaint entire area now.void
repaintCharRect
(int x, int y, int cx, int cy) Repaints one or two rectangles in character scaling.void
Repaints one or two rectangles in character scaling.void
repaintPixelRect
(int x, int y, int cx, int cy) The repaint a rectangle, later.void
The repaint a rectangle, later.void
repaintText
(int beginPos, int endPos) Change of character/color data between two positions.void
run()
The action performed is actually a timer message and causes the cursor to flash.void
setCapture
(boolean on) Sets mouse capture.boolean
setCursorVisible
(boolean on) Shows or hides the cursor for a session.void
setFocusProcessing
(boolean on) setIgnoreFocusTimevoid
setInsertMode
(boolean on) Sets the insert mode indicator.void
setMoveSize
(boolean on) Call to set moving/sizing in order to skip cursor drawing.void
setPreview
(boolean doAntiAlias) Preview anti-alias.void
setScreenSize
(int cx, int cy, char[] cd, int[] ad) Sets the current screen size.void
setShowHiddenText
(boolean on) Sets showing of hidden text.void
update()
Updates the terminal window now, after a repaint.void
Dispose listener.
Constructor Details
TerminalWindow
public TerminalWindow(Canvas canvas, TerminalStatusBar statusBar, IScreenDesigner designer, int cx, int cy, int x, int y, char[] cd, int[] ad, TerminalWindowListener listener, TerminalSettings settings) The constructor creates the child components (terminal display with possible scroll bars and the status bar. It also starts to listen to keystrokes and focus changes.- Parameters:
canvas
- The canvas.statusBar
- The status bar.designer
- The designer interface.cx
- Width.cy
- Height.x
- X position.y
- Y position.cd
- Character data.ad
- Attribute data.listener
- Listener.settings
- Settings.
Method Details
setPreview
public void setPreview(boolean doAntiAlias) Preview anti-alias.- Parameters:
doAntiAlias
- Flag to perform anti-alias or not.
getScreenWidth
public int getScreenWidth()Gets the screenWidth.- Returns:
- The screen width.
getScreenHeight
public int getScreenHeight()Gets the screenHeight.- Returns:
- The screen height.
getTopMargin
public int getTopMargin()Gets the top margin.- Returns:
- The top margin.
getLeftMargin
public int getLeftMargin()Gets the left margin.- Returns:
- The left margin.
getFontWidth
public int getFontWidth()Gets the font width.- Returns:
- The font width in pixels.
getFontHeight
public int getFontHeight()Gets the font height.- Returns:
- The font height in pixels.
keyPressed
Key pressed.- Specified by:
keyPressed
in interfaceKeyListener
- Parameters:
e
- The KeyEvent.
doKeyPressed
Key pressed.- Parameters:
e
- The KeyEvent.
keyReleased
Key released.- Specified by:
keyReleased
in interfaceKeyListener
- Parameters:
e
- The KeyEvent.
doKeyReleased
Key released.- Parameters:
e
- The KeyEvent.
getCursorPoint
Gets the current point of the cursor relative the "frame".setCapture
public void setCapture(boolean on) Sets mouse capture.mouseDown
Mouse pressed.- Specified by:
mouseDown
in interfaceMouseListener
doMouseDown
Mouse pressed.mouseDoubleClick
Mouse double-click.- Specified by:
mouseDoubleClick
in interfaceMouseListener
doMouseDoubleClick
Mouse double-click, continued.mouseUp
Mouse released.- Specified by:
mouseUp
in interfaceMouseListener
doMouseUp
Mouse released, continued.mouseMove
Mouse move.- Specified by:
mouseMove
in interfaceMouseMoveListener
addMark
public void addMark(int x, int y, int cx, int cy) Adds a mark.addMark
Adds a mark.removeMark
public boolean removeMark(int x, int y, int cx, int cy) Removes a mark.- Returns:
- true for success, false if not found.
widgetDisposed
Dispose listener.- Specified by:
widgetDisposed
in interfaceDisposeListener
paintControl
The paint listener.- Specified by:
paintControl
in interfacePaintListener
onNewSize
public void onNewSize(int cx, int cy) Called when a new size is set.computeSize
Gets the minimum size without scroll bars.repaint
public void repaint()Repaint entire area now.update
public void update()Updates the terminal window now, after a repaint.getCursorLocation
Gets the current pointer position relative canvas.repaintPixelRect
The repaint a rectangle, later.repaintPixelRect
public void repaintPixelRect(int x, int y, int cx, int cy) The repaint a rectangle, later.repaintCharRect
Repaints one or two rectangles in character scaling.repaintCharRect
public void repaintCharRect(int x, int y, int cx, int cy) Repaints one or two rectangles in character scaling.setFocusProcessing
public void setFocusProcessing(boolean on) setIgnoreFocusTimefocusGained
Focus gained.- Specified by:
focusGained
in interfaceFocusListener
focusLost
Focus is lost.- Specified by:
focusLost
in interfaceFocusListener
setMoveSize
public void setMoveSize(boolean on) Call to set moving/sizing in order to skip cursor drawing.run
public void run()The action performed is actually a timer message and causes the cursor to flash.setCursorVisible
public boolean setCursorVisible(boolean on) Shows or hides the cursor for a session.repaintText
public void repaintText(int beginPos, int endPos) Change of character/color data between two positions.setInsertMode
public void setInsertMode(boolean on) Sets the insert mode indicator.hasMark
public boolean hasMark()Get the current selected mark.- Returns:
- Rectangle
hasSingleMark
public boolean hasSingleMark()Check for a single mark.- Returns:
- Rectangle
getMarks
Get the current selected marks.- Returns:
- Rectangle array.
setScreenSize
public void setScreenSize(int cx, int cy, char[] cd, int[] ad) Sets the current screen size.getFontName
Gets the font name used.setShowHiddenText
public void setShowHiddenText(boolean on) Sets showing of hidden text.