Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

ScreenKit.java

Go to the documentation of this file.
00001 // -*-Java-*- 
00010 
00012 package pkgView;
00013 
00014 import java.util.Vector;
00015 import java.util.Enumeration;
00016 import java.lang.System;
00017 import java.io.*;
00018 
00020 public class ScreenKit {
00021 
00022    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00026    private ScreenKit() {
00027       initScreen();     
00028       ttyInitPair( PAIR_BLACK_RED,    NC_BLACK,  NC_RED );
00029       ttyInitPair( PAIR_BLACK_GREEN,  NC_BLACK,  NC_GREEN );
00030       ttyInitPair( PAIR_BLACK_YELLOW, NC_BLACK,  NC_YELLOW );
00031       ttyInitPair( PAIR_BLACK_BLUE,   NC_BLACK,  NC_BLUE );
00032       ttyInitPair( PAIR_BLACK_MAGENTA,NC_BLACK,  NC_MAGENTA );
00033       ttyInitPair( PAIR_BLACK_CYAN,   NC_BLACK,  NC_CYAN );
00034       ttyInitPair( PAIR_BLACK_WHITE,  NC_BLACK,  NC_WHITE );
00035       ttyInitPair( PAIR_WHITE_BLUE ,  NC_WHITE,  NC_BLUE );
00036       ttyInitPair( PAIR_WHITE_BLACK , NC_WHITE,  NC_BLACK );
00037       ttyInitPair( PAIR_YELLOW_BLUE , NC_YELLOW, NC_BLUE );
00038 
00039    }
00040 
00041    private static ScreenKit instance = null;
00042    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00048    public static ScreenKit getSingleton() {
00049       if ( instance == null) {
00050          instance = new ScreenKit();
00051       }
00052       return instance;
00053    }
00054 
00058    public native void ttyMvAddStr(int row, int col, String str, int len,
00059                                   int attrib, int pairNum);
00060 
00061 
00065    public native void ttyMove( int row, int col );
00066 
00067 
00068    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00072    public native void ttyDrawBox(
00073                                  int y, // first row
00074                                  int x, // first column
00075                                  int rows, // #rows
00076                                  int cols, // #cols
00077                                  int pair  // color pair
00078                                  );
00079 
00080    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00084    public native void ttyDrawHline(
00085                                  int y, // first row
00086                                  int x, // first column
00087                                  int ch, // character
00088                                  int len, // length
00089                                  int pair  // color pair
00090                                  );
00091 
00092 
00093 
00094    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00098    public native void ttyDrawVline(
00099                                  int y, // first row
00100                                  int x, // first column
00101                                  int ch, // character
00102                                  int len, // length
00103                                  int pair  // color pair
00104                                  );
00105 
00106    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00111    public native void ttyInitPair(int pairNum, int fg, int bg );
00112 
00113 
00117    public native void ttyEndWin();
00118 
00119 
00120    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00124    public native void ttySaveScreen();
00125 
00127    public native void ttyShellScreen( String str);
00128 
00132    public native void ttyRestoreScreen();
00133 
00134    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00138    public native void ttyClear();
00139 
00140 
00141    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00145    public native void ttyEraseRow(int row, int col, int len, 
00146                                   int attrib, int pairNum);
00147 
00148    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00152    public native void ttyBeep();
00153 
00154    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00158    public native void ttyRefresh();
00159 
00160 
00161    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00164    public native int ttyGetKey(int timeout); 
00165 
00166 
00167 
00168    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00173    public native static boolean initScreen();
00174 
00175    // these should match Ncurses colors
00176 
00177    public final static int NC_BLACK   = 0; 
00178    public final static int NC_RED     = 1; 
00179    public final static int NC_GREEN   = 2; 
00180    public final static int NC_YELLOW  = 3; 
00181    public final static int NC_BLUE    = 4; 
00182    public final static int NC_MAGENTA = 5; 
00183    public final static int NC_CYAN    = 6; 
00184    public final static int NC_WHITE   = 7; 
00185 
00186    // following are color indices for init_pair();
00187    public final static int PAIR_BLACK_RED      = 1; 
00188    public final static int PAIR_BLACK_GREEN    = 2; 
00189    public final static int PAIR_BLACK_YELLOW   = 3; 
00190    public final static int PAIR_BLACK_BLUE     = 4; 
00191    public final static int PAIR_BLACK_MAGENTA  = 5; 
00192    public final static int PAIR_BLACK_CYAN     = 6; 
00193    public final static int PAIR_BLACK_WHITE    = 7; 
00194    public final static int PAIR_WHITE_BLUE     = 8; 
00195    public final static int PAIR_WHITE_BLACK    = 9; 
00196    public final static int PAIR_YELLOW_BLUE    = 10; 
00197    public final static int PAIRS_MAX = 10; 
00198 
00199    public static int ncColorPairs = 0; 
00200 
00201    // following are colors for the MCJ application
00202    public final static int
00203       COLOR_BOX       = PAIR_WHITE_BLUE, 
00204       COLOR_TITLE     = PAIR_YELLOW_BLUE; 
00205 
00206    // these shadow an enumeration list in tty.cc
00207    // use them to set attributes
00208    public final static int
00209       SK_NORMAL        = 0, 
00210       SK_STANDOUT      = 1, 
00211       SK_UNDERLINE     = 2, 
00212       SK_REVERSE       = 3, 
00213       SK_BLINK         = 4, 
00214       SK_DIM           = 5, 
00215       SK_BOLD          = 6, 
00216       SK_PROTECT       = 7, 
00217       SK_INVIS         = 8, 
00218       SK_ALTCHARSET    = 9, 
00219       SK_CHARTEXT      = 10; 
00220 
00221 
00222    public final static int
00223       PANEL_TS         = 1,     
00224       PANEL_LS         = 0,     
00225       PANEL_RS         = 79,    
00226       PANEL_BS         = 20,    
00227       PANEL_HINT_ROW   = 22, 
00228       PANEL_SHELL_ROW  = 23, 
00229       FUNC_KEY_ROW     = 24; 
00230 
00231    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00232 }// ScreenKit.java

SourceForge.net Logo