Package shell

Class Console


  • public class Console
    extends java.lang.Object
    Poskytuje metody pro ovládání stylu vypisovaných textů. Tvoří uživatelsky přívětivé rozhraní mezi Java aplikací a technologickým standardem ovládání textového zařízení (terminálu). Zdroje: ECMA; man console_codes; https://en.wikipedia.org/wiki/ANSI_escape_code
    
     //Příklady užití:
     //tučné písmo (3 způsoby):
              Console.bold();                 // analogicky: halfBright,underline,blink,reverse
              Console.set(BOLD);              // --||--      HALF_BRIGHT,UNDERLINE,BLINK,REVERSE
              Console.set(BOLD,ON);           // --||--
         //výchozí stav:
              Console.set(BOLD,OFF);          // --||--
              Console.bold(OFF);              // --||--
     //červená barva:
              Console.color(RED);             //popředí
              Console.color(RED,true);        //pozadí
              Console.color(RED,false,true);  //popředí,světlejší
              Console.color(RED,true,true);   //pozadí,světlejší
         //výchozí stav:
              Console.color(RESET);           //popředí
              Console.color(RESET,true);      //pozadí
              Console.color(RESET,false,true);//popředí,světlejší
              Console.color(RESET,true,true); //pozadí,světlejší
     //výchozí stav všech parametrů:
              Console.reset();
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BLACK
      black color constant for parametric setup
      static int BLINK
      blink text style constant for parametric setup
      static int BLUE
      blue color constant for parametric setup
      static int BOLD
      bold text style constant for parametric setup
      static int CYAN
      cyan color constant for parametric setup
      static int GREEN
      green color constant for parametric setup
      static int HALF_BRIGHT
      half bright constant for parametric setup
      static int OFF
      constant for ON/OFF parametric setup
      static int ON
      constant for ON/OFF parametric setup
      static int PURPLE
      purple color constant for parametric setup
      static int RED
      red color constant for parametric setup
      static int RESET
      constant for reset parametric setup
      static int RESET_ALL
      reset all console parameters constant
      static int REVERSE
      reverse text style constant for parametric setup
      static int UNDERLINE
      underline text style constant for parametric setup
      static int WHITE
      white color constant for parametric setup
      static int YELLOW
      yellow color constant for parametric setup
    • Constructor Summary

      Constructors 
      Constructor Description
      Console()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void blink()
      switch blink ON
      static void blink​(int off)
      switch blink ON/OFF
      static void bold()
      switch bold ON
      static void bold​(int off)
      switch bold ON/OFF
      static void color​(int color)
      set any color from the color table for foregroun adn standard bright
      static void color​(int color, boolean background)
      set any color from the color table for standard bright
      static void color​(int color, boolean background, boolean bright)
      set any color from the color table
      static void halfBright()
      switch halfBright ON
      static void halfBright​(int off)
      switch half bright ON/OFF
      static void reset()
      reset all console parameters
      static void reverse()
      switch reverse ON
      static void reverse​(int off)
      switch reverse ON/OFF
      static void set​(int i)
      print any escape code to the standard output
      static void set​(int i, int off)
      print escape code for both switch state (ON/OFF)
      static void underline()
      switch underline ON
      static void underline​(int off)
      switch underline ON/OFF
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BLACK

        public static final int BLACK
        black color constant for parametric setup
        See Also:
        Constant Field Values
      • RED

        public static final int RED
        red color constant for parametric setup
        See Also:
        Constant Field Values
      • GREEN

        public static final int GREEN
        green color constant for parametric setup
        See Also:
        Constant Field Values
      • YELLOW

        public static final int YELLOW
        yellow color constant for parametric setup
        See Also:
        Constant Field Values
      • BLUE

        public static final int BLUE
        blue color constant for parametric setup
        See Also:
        Constant Field Values
      • PURPLE

        public static final int PURPLE
        purple color constant for parametric setup
        See Also:
        Constant Field Values
      • CYAN

        public static final int CYAN
        cyan color constant for parametric setup
        See Also:
        Constant Field Values
      • WHITE

        public static final int WHITE
        white color constant for parametric setup
        See Also:
        Constant Field Values
      • RESET_ALL

        public static final int RESET_ALL
        reset all console parameters constant
        See Also:
        Constant Field Values
      • BOLD

        public static final int BOLD
        bold text style constant for parametric setup
        See Also:
        Constant Field Values
      • HALF_BRIGHT

        public static final int HALF_BRIGHT
        half bright constant for parametric setup
        See Also:
        Constant Field Values
      • UNDERLINE

        public static final int UNDERLINE
        underline text style constant for parametric setup
        See Also:
        Constant Field Values
      • BLINK

        public static final int BLINK
        blink text style constant for parametric setup
        See Also:
        Constant Field Values
      • REVERSE

        public static final int REVERSE
        reverse text style constant for parametric setup
        See Also:
        Constant Field Values
      • RESET

        public static final int RESET
        constant for reset parametric setup
        See Also:
        Constant Field Values
    • Constructor Detail

      • Console

        public Console()
    • Method Detail

      • set

        public static void set​(int i)
        print any escape code to the standard output
        Parameters:
        i - escape code
      • set

        public static void set​(int i,
                               int off)
        print escape code for both switch state (ON/OFF)
        Parameters:
        i - escape code
        off - ON/OFF code
      • color

        public static void color​(int color,
                                 boolean background,
                                 boolean bright)
        set any color from the color table
        Parameters:
        color - color from the color table (BLACK,RED,GREEN,YELLOW,BLUE,PURPLE,CYAN,WHITE)
        background - foregroud/background selector
        bright - bright/standard light selector
      • color

        public static void color​(int color,
                                 boolean background)
        set any color from the color table for standard bright
        Parameters:
        color - color from the color table (BLACK,RED,GREEN,YELLOW,BLUE,PURPLE,CYAN,WHITE)
        background - foregroud/background selector
      • color

        public static void color​(int color)
        set any color from the color table for foregroun adn standard bright
        Parameters:
        color - color from the color table (BLACK,RED,GREEN,YELLOW,BLUE,PURPLE,CYAN,WHITE)
      • reset

        public static void reset()
        reset all console parameters
      • bold

        public static void bold​(int off)
        switch bold ON/OFF
        Parameters:
        off - ON/OFF selector
      • halfBright

        public static void halfBright​(int off)
        switch half bright ON/OFF
        Parameters:
        off - ON/OFF selector
      • underline

        public static void underline​(int off)
        switch underline ON/OFF
        Parameters:
        off - ON/OFF selector
      • blink

        public static void blink​(int off)
        switch blink ON/OFF
        Parameters:
        off - ON/OFF selector
      • reverse

        public static void reverse​(int off)
        switch reverse ON/OFF
        Parameters:
        off - ON/OFF selector
      • bold

        public static void bold()
        switch bold ON
      • halfBright

        public static void halfBright()
        switch halfBright ON
      • underline

        public static void underline()
        switch underline ON
      • blink

        public static void blink()
        switch blink ON
      • reverse

        public static void reverse()
        switch reverse ON