3import java.io.PrintStream;
 
    7  public static final int BLACK=0;
 
    8  public static final int RED=1;
 
    9  public static final int GREEN=2;
 
   11  public static final int BLUE=4;
 
   13  public static final int CYAN=6;
 
   14  public static final int WHITE=7;
 
   66  public static final String 
NORMAL=
"\033[0m";
 
   68  public static final String 
BOLD=
"\033[1m";
 
   73  public static final String 
HOME=
"\033[1;1H";
 
   87  public PrintStream 
out=System.out;
 
  104      System.err.println(
"Assuming dumb terminal.");
 
  111    this(!System.getProperty(
"os.name").startsWith(
"Windows"));
 
  115  public boolean dumb() { 
return !ansi_; }
 
  118  public void fg(
int color) {
 
  125      color=
invert_color ? table.length-color%table.length : color;
 
  126      out.print(table[color]);
 
  132  public void bg(
int color) {
 
  139      color=
invert_color ? table.length-color%table.length : color;
 
  140      out.print(table[color]);
 
  146  public void cls(
boolean clear) {
 
  157       boolean cur_b=(cur_font_==1);
 
static final String HOME
reset cursor position to upper left corner
 
PrintStream out
output stream, user is responsible for flush
 
static final String BOLD
set normal text
 
void cls(boolean clear)
clear screen (for clear=false, move only cursor)
 
boolean invert_foreground_background
swap foreground and background
 
void hideCursor()
hide cursor
 
static final int HI_WHITE
 
void showCursor()
show cursor
 
static final String[] BGCOLOR
set background color
 
void reset()
reset to black on white, normal font
 
Terminal(boolean ansi)
Constructor.
 
static final String HIDE_CURSOR
hide cursor
 
static final int HI_GREEN
 
Terminal()
Constructor: guess availability of terminal emulation.
 
static final int HI_MAGENTA
 
static final String NORMAL
set bold text
 
static final int HI_YELLOW
 
boolean invert_color
invert colors
 
static final String[] FGCOLOR
set foreground color
 
void cls()
clear screen (cls(true))
 
void fg(int color)
set foreground color
 
static final int HIGHLIGHT
 
static final String CLEAR_SCREEN
clear screen and reset cursor position to upper left corner
 
static final int HI_BLACK
 
static final String SHOW_CURSOR
show cursor
 
boolean dumb()
Is this a dumb terminal without colors?
 
void bold(boolean b)
switch use of bold font
 
static Terminal instance
singleton instance
 
void bg(int color)
set background color