Correct manage of FocusEvents
public FocusEvent getLastFocusEvent()
protected void setLastFocusEvent(FocusEvent ev_ )
ACS_BTEE
public static final int ACS_BTEE
ACS_BULLET
public static final int ACS_BULLET
ACS_CKBOARD
public static final int ACS_CKBOARD
ACS_DEGREE
public static final int ACS_DEGREE
ACS_DIAMOND
public static final int ACS_DIAMOND
ACS_HLINE
public static final int ACS_HLINE
ACS_LLCORNER
public static final int ACS_LLCORNER
ACS_LRCORNER
public static final int ACS_LRCORNER
ACS_LTEE
public static final int ACS_LTEE
ACS_PLMINUS
public static final int ACS_PLMINUS
ACS_PLUS
public static final int ACS_PLUS
ACS_RTEE
public static final int ACS_RTEE
ACS_S1
public static final int ACS_S1
ACS_S9
public static final int ACS_S9
ACS_TTEE
public static final int ACS_TTEE
ACS_ULCORNER
public static final int ACS_ULCORNER
ACS_URCORNER
public static final int ACS_URCORNER
ACS_VLINE
public static final int ACS_VLINE
A_ALTCHARSET
public static final int A_ALTCHARSET
A_BLINK
public static final int A_BLINK
A_BOLD
public static final int A_BOLD
A_DIM
public static final int A_DIM
A_INVIS
public static final int A_INVIS
A_NORMAL
public static final int A_NORMAL
A_REVERSE
public static final int A_REVERSE
A_STANDOUT
public static final int A_STANDOUT
A_UNDERLINE
public static final int A_UNDERLINE
Auml
public static final char Auml
BLACK
public static final int BLACK
BLUE
public static final int BLUE
BUTTON1_CLICKED
public static final int BUTTON1_CLICKED
BUTTON1_PRESSED
public static final int BUTTON1_PRESSED
BUTTON1_RELEASED
public static final int BUTTON1_RELEASED
BUTTON2_CLICKED
public static final int BUTTON2_CLICKED
BUTTON2_PRESSED
public static final int BUTTON2_PRESSED
BUTTON2_RELEASED
public static final int BUTTON2_RELEASED
BUTTON3_CLICKED
public static final int BUTTON3_CLICKED
BUTTON3_PRESSED
public static final int BUTTON3_PRESSED
BUTTON3_RELEASED
public static final int BUTTON3_RELEASED
CYAN
public static final int CYAN
Ccedil
public static final char Ccedil
Eacute
public static final char Eacute
Euml
public static final char Euml
GREEN
public static final int GREEN
KEY_MOUSE
public static final int KEY_MOUSE
MAGENTA
public static final int MAGENTA
Ouml
public static final char Ouml
RED
public static final int RED
Uuml
public static final char Uuml
WHITE
public static final int WHITE
YELLOW
public static final int YELLOW
_defaultBackground
public static Color _defaultBackground
_defaultForeground
public static Color _defaultForeground
isColorEnabled
public static final boolean isColorEnabled
This flag is true is the system property "charva.color" has been set.
COLOR_PAIR_ATTRIBUTE
public static int COLOR_PAIR_ATTRIBUTE(int pair_)
Emulates the terminfo COLOR_PAIR macro.
addChar
public void addChar(int chr,
int attrib,
int colorpair_)
Add a character to the virtual terminal at the current cursor position.
addHorizontalLine
public void addHorizontalLine(int length_,
int attrib_,
int colorpair)
Draw a horizontal line of the specified length starting at the current
cursor position.
addString
public void addString(String str_,
int attrib_,
int colorpair_)
Add a string to the virtual terminal at the current cursor position.
addVerticalLine
public void addVerticalLine(int length_,
int attrib_,
int colorpair_)
Draw a vertical line of the specified length starting at the current
cursor position.
beep
public void beep()
Ring the terminal's bell.
blankBox
public void blankBox(Point origin_,
Dimension size_,
int colorpair_)
Blank out a box using the specified color pair.
origin_
- The top left corner of the rectangle.size_
- The dimensions of the rectangle to blank out.colorpair_
- The number of the color-pair (foreground+background)
to use for blanking the rectangle.
blankBoxNative
public void blankBoxNative(int left_,
int top_,
int right_,
int bottom_,
int colorpair_)
Blank out the specified rectangle.
checkForKeystroke
public void checkForKeystroke()
Wait up to 100msec for a keystroke (or mouse-event).
clear
public void clear()
Clears the screen (calls the curses clear() function).
close
public void close()
Close the terminal window and restore terminal settings
(calls the curses endwin() function).
drawBox
public void drawBox(Point origin_,
Dimension size_)
Draw a box.
drawBox
public void drawBox(Point origin_,
Dimension size_,
int colorpair_)
Draw a box using the specified color pair.
drawBoxNative
public void drawBoxNative(int left_,
int top_,
int right_,
int bottom_,
int colorpair_)
fireKeystroke
public void fireKeystroke(int key_)
Processes a keystroke that was pressed in the currently displayed
window.
key_
- the keystroke that was pressed. If it is less than
256, it is a ASCII or ISO8859-1 code; otherwise it is a function
key as defined in the "VK_*" values.
fireKeystroke
public void fireKeystroke(int key_,
Component source_)
Process a keystroke as if it was pressed while the focus was in the
specified component.
key_
- the keystroke that was pressed. If it is less than
256, it is an ASCII or ISO8859-1 code; otherwise it is a function
key as defined in the "VK_*" values.
fireMouseEvent
public void fireMouseEvent(charva.awt.MouseEventInfo mouse_info)
Processes the mouse-click specified by mouse_info.
Note that we disable mouse-click resolution in the ncurses library
by setting "mouse_interval" to 0, because it doesn't appear to work properly.
Instead we do it in this method.
getBooleanCapability
public boolean getBooleanCapability(String capname_)
throws TerminfoCapabilityException
Provides an interface to the ncurses "tigetflag()" function.
getColorPairIndex
public int getColorPairIndex(ColorPair pair_)
throws TerminfoCapabilityException
Returns the color-pair index corresponding to the specified
color-pair. If the color pair does not exist yet, it is created
using the ncurses "init_pair" function. If all the available
color-pairs are already in use, a TerminfoCapabilityException
is thrown.
getCursor
public Point getCursor()
Get absolute cursor position
getCursor
public Point getCursor(Point p_)
Get absolute cursor position. Use this overloaded version to
avoid allocating a new Point on the heap.
getDefaultBackground
public static Color getDefaultBackground()
Returns the default background color.
getDefaultForeground
public static Color getDefaultForeground()
Returns the default foreground color.
getDefaultToolkit
public static Toolkit getDefaultToolkit()
This static method instantiates a Toolkit object if it does not
already exist; and returns a reference to the instantiated Toolkit.
getLastFocusEvent
public FocusEvent getLastFocusEvent()
getMaxColorPairs
public int getMaxColorPairs()
Returns the maximum number of color-pairs (provides an interface
to the ncurses COLOR_PAIRS global variable).
getMouseEventInfo
public charva.awt.MouseEventInfo getMouseEventInfo()
Get information about a mouse event (i.e the coordinates, and which
button was clicked).
getNumericCapability
public int getNumericCapability(String capname_)
throws TerminfoCapabilityException
Provides an interface to the ncurses "tigetnum()" function.
getScreenColumns
public int getScreenColumns()
getScreenRows
public int getScreenRows()
getScreenSize
public Dimension getScreenSize()
getStringCapability
public String getStringCapability(String capname_)
throws TerminfoCapabilityException
Provides an interface to the ncurses "tigetstr()" function.
getSystemEventQueue
public EventQueue getSystemEventQueue()
getTopWindow
public Window getTopWindow()
Get the top window of the window stack.
getTtyName
public String getTtyName()
Returns the tty device name (provides an interface to the
Unix C function "ttyname()").
hasColors
public boolean hasColors()
Returns true if the terminal is capable of displaying colours.
initColorPair
public void initColorPair(int pair_,
int fgnd_,
int bgnd_)
throws TerminfoCapabilityException
Provides an interface to the terminfo "init_pair()" function.
isActionKey
public static boolean isActionKey(int _key)
Returns true if the key code is greater than 255, indicating
that it is a function key.
isWindowDisplayed
public boolean isWindowDisplayed(Window window_)
Returns true if the specified window is currently displayed.
key2ASCII
public static String key2ASCII(int key_)
Convert the integer representation of a keystroke to an ASCII string.
print
public void print(String str_)
throws TerminfoCapabilityException
Provides an interface to the ncurses "mcprint()" function to ship
the specified string to a printer attached to the terminal. Makes
use of the "mc4" and "mc5" capabilities of the terminal (see
"man curs_print").
putp
public void putp(String str_)
Provides an interface to the ncurses "putp()" function, to write a
string to the terminal; the string must be a return value from
getStringCapability().
redrawWin
public void redrawWin()
Indicate to ncurses that all the lines on the screen have changed
and need to be redrawn the next time Toolkit.sync() is called. This
just calls the ncurses function "redrawwin(stdscr)".
resetClipRect
public void resetClipRect()
Reset the clipping rectangle to the screen size.
setClipRect
public void setClipRect(Rectangle clip_)
Set a clipping rectangle.
setClipRectNative
public void setClipRectNative(int left_,
int top_,
int right_,
int bottom_)
Set a clipping rectangle.
setCursor
public void setCursor(Point p)
Set absolute cursor position
setCursor
public void setCursor(int x_,
int y_)
Set absolute cursor position
setDefaultBackground
public static void setDefaultBackground(Color color_)
Changes the default background color.
setDefaultForeground
public static void setDefaultForeground(Color color_)
Changes the default foreground color.
setLastFocusEvent
protected void setLastFocusEvent(FocusEvent ev_)
startColors
public void startColors()
An interface to the terminfo "start_colors()" function.
sync
public void sync()
Synchronize the state of the physical terminal with the state of
the virtual terminal maintained by curses (ie provides an interface
to the curses refresh() function).
triggerGarbageCollection
public void triggerGarbageCollection(Component source_)
Trigger garbage collection. This method can be called inside an
event handler, but the call to System.gc()
will be
made after the event handler has completed (i.e. after drawing is
completed). This is a convenient, but OPTIONAL, way of ensuring
that the heap does not grow too large. Some experts say that it is
better not to call System.gc() explicitly from inside an application;
you take your pick.
source_
- the component that triggered the garbage collection
(not important).