|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.slashie.libjcsi.wswing.WSwingConsoleInterface
public class WSwingConsoleInterface
Swing interface for input and output. Returns keystrokes as CharKeys. Shows the characters in a Frame
| Field Summary | |
|---|---|
static java.awt.Font |
consoleFont
Current printing cursor position |
static int |
xdim
|
static int |
ydim
|
| Fields inherited from interface net.slashie.libjcsi.ConsoleSystemInterface |
|---|
BLACK, BLUE, BROWN, CYAN, DARK_BLUE, DARK_RED, GRAY, GREEN, LEMON, LIGHT_GRAY, MAGENTA, PURPLE, RED, TEAL, WHITE, YELLOW |
| Constructor Summary | |
|---|---|
WSwingConsoleInterface(java.lang.String windowName,
boolean sandboxDeploy)
Allows for setting the window's name and deploying as a Java WebStart application. |
|
| Method Summary | |
|---|---|
void |
cls()
Clears the screen |
void |
componentHidden(java.awt.event.ComponentEvent e)
|
void |
componentMoved(java.awt.event.ComponentEvent e)
|
void |
componentResized(java.awt.event.ComponentEvent e)
|
void |
componentShown(java.awt.event.ComponentEvent e)
|
void |
flash(int color)
Flashes the output area a specified color. |
void |
flushColorTable()
This flushes the internal Hashtable for the colors. |
int |
getColor(java.lang.String colorName)
|
CharKey |
inkey()
Waits until a key is pressed and returns it |
java.lang.String |
input()
Reads a string from the keyboard |
java.lang.String |
input(int l)
Reads a string from the keyboard with a maximum length |
boolean |
isInsideBounds(int x,
int y)
|
boolean |
isInsideBounds(Position p)
Checks if the position is valid |
void |
locate(int x,
int y)
|
void |
locateCaret(int x,
int y)
Locates the input caret on a given position |
char |
peekChar(int x,
int y)
Checks what character is at a given position |
int |
peekColor(int x,
int y)
Checks what color is at a given position |
CSIColor |
peekCSIColor(int x,
int y)
|
void |
print(int x,
int y,
char what,
CSIColor color)
Prints a character on the console, using a custom color |
void |
print(int x,
int y,
char what,
CSIColor color,
CSIColor back)
|
void |
print(int x,
int y,
char what,
int color)
Prints a character on the console |
void |
print(int x,
int y,
java.lang.String what)
Prints a String on the console with the default color. |
void |
print(int x,
int y,
java.lang.String what,
CSIColor color)
Prints a String on the console, using a custom color. |
void |
print(int x,
int y,
java.lang.String what,
CSIColor color,
CSIColor background)
|
void |
print(int x,
int y,
java.lang.String what,
int color)
Prints a String on the console in the color specified. |
void |
refresh()
Refreshes the screen, printing all characters that were buffered Some implementations may instead write directly to the console |
void |
refresh(java.lang.Thread toNotify)
Refreshes the screen, printing all characters that were buffered, and interrupts the Thread Some implementations may instead write directly to the console |
void |
restore()
Restores the contents of the backup buffer to screen |
void |
run()
|
void |
safeprint(int x,
int y,
char what,
int color)
Same as print but must check for validity of the coordinates |
void |
saveBuffer()
Saves the screen contents to a backup buffer |
void |
setAutoRefresh(boolean value)
Sets whether or not a buffer will be used |
void |
waitKey(int keyCode)
Waits for the user to press a key |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.awt.Font consoleFont
public static int xdim
public static int ydim
| Constructor Detail |
|---|
public WSwingConsoleInterface(java.lang.String windowName,
boolean sandboxDeploy)
windowName - sandboxDeploy - true if intended at a Java Webstart application| Method Detail |
|---|
public void flash(int color)
flash in interface ConsoleSystemInterfacecolor - public void flushColorTable()
ConsoleSystemInterface
flushColorTable in interface ConsoleSystemInterfacepublic void cls()
ConsoleSystemInterface
cls in interface ConsoleSystemInterface
public void locate(int x,
int y)
public void refresh()
ConsoleSystemInterface
refresh in interface ConsoleSystemInterface
public void print(int x,
int y,
java.lang.String what,
int color)
ConsoleSystemInterface
print in interface ConsoleSystemInterfacex - horizontal starting positiony - vertical positionwhat - The string to be printedcolor - The color, one of the ConsoleSystemInterface constants
public void print(int x,
int y,
java.lang.String what,
CSIColor color)
ConsoleSystemInterface
print in interface ConsoleSystemInterfacex - horizontal positiony - vertical positionwhat - The String to be printedcolor - The color, a rgba instance of CSIColor
public void print(int x,
int y,
java.lang.String what,
CSIColor color,
CSIColor background)
public void print(int x,
int y,
char what,
int color)
ConsoleSystemInterface
print in interface ConsoleSystemInterfacex - horizontal positiony - vertical positionwhat - The character to be printedcolor - The color, one of the ConsoleSystemInterface constants
public void print(int x,
int y,
char what,
CSIColor color)
ConsoleSystemInterface
print in interface ConsoleSystemInterfacex - horizontal positiony - vertical positionwhat - The character to be printedcolor - The color, a rgba instance of CSIColor
public void print(int x,
int y,
char what,
CSIColor color,
CSIColor back)
public void print(int x,
int y,
java.lang.String what)
ConsoleSystemInterface
print in interface ConsoleSystemInterfacex - horizontal starting positiony - vertical starting positionwhat - The String to be printed
public void locateCaret(int x,
int y)
ConsoleSystemInterface
locateCaret in interface ConsoleSystemInterfacex - horizontal positiony - vertical positionpublic java.lang.String input()
ConsoleSystemInterface
input in interface ConsoleSystemInterfacepublic java.lang.String input(int l)
ConsoleSystemInterface
input in interface ConsoleSystemInterfacepublic void refresh(java.lang.Thread toNotify)
ConsoleSystemInterface
refresh in interface ConsoleSystemInterfacepublic CharKey inkey()
ConsoleSystemInterface
inkey in interface ConsoleSystemInterfacepublic int getColor(java.lang.String colorName)
public void setAutoRefresh(boolean value)
ConsoleSystemInterface
setAutoRefresh in interface ConsoleSystemInterfacevalue - true to activate buffer
public char peekChar(int x,
int y)
ConsoleSystemInterface
peekChar in interface ConsoleSystemInterfacex - horizontal positiony - vertical position
public int peekColor(int x,
int y)
ConsoleSystemInterface
peekColor in interface ConsoleSystemInterfacex - horizontal positiony - vertical position
public CSIColor peekCSIColor(int x,
int y)
public void run()
run in interface java.lang.Runnablepublic boolean isInsideBounds(Position p)
ConsoleSystemInterface
isInsideBounds in interface ConsoleSystemInterfacep - position to be tested
public boolean isInsideBounds(int x,
int y)
public void safeprint(int x,
int y,
char what,
int color)
ConsoleSystemInterface
safeprint in interface ConsoleSystemInterfacex - horizontal positiony - vertical positionwhat - The character to be printedcolor - The color, one of the ConsoleSystemInterface constantspublic void componentHidden(java.awt.event.ComponentEvent e)
componentHidden in interface java.awt.event.ComponentListenerpublic void componentMoved(java.awt.event.ComponentEvent e)
componentMoved in interface java.awt.event.ComponentListenerpublic void componentResized(java.awt.event.ComponentEvent e)
componentResized in interface java.awt.event.ComponentListenerpublic void componentShown(java.awt.event.ComponentEvent e)
componentShown in interface java.awt.event.ComponentListenerpublic void waitKey(int keyCode)
ConsoleSystemInterface
waitKey in interface ConsoleSystemInterfacekeyCode - code of specific key to wait forpublic void restore()
ConsoleSystemInterface
restore in interface ConsoleSystemInterfacepublic void saveBuffer()
ConsoleSystemInterface
saveBuffer in interface ConsoleSystemInterface
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||