Saturday, 20 December 2014

Clear command line console and display bold size of string in Java Command Line Application


To clean console of your command line application,use following code :


  /**  
   * This method clear the current screen  
   *   
   *   
   */  
   public static void clearScreen() {  
    System.out.print("\033[H\033[2J");  
    System.out.flush();  
   }  



To make bold size of any string,

  public void boldSizeOfString()  
   {  
       String strNormalSize = "\033[0;0m";  
       String strBoldSize = "\033[0;1m";  
         System.out.println (strNormalSize + "My Name is Anthony Gonsalves" + strBoldSize);  
   }  














3 comments:

  1. Replies
    1. Try running your Program in Command Line and check if it works or not.

      Delete
  2. Hi can you explain or link to why it's working.. What is it actually doing?
    best Regards Jonas

    ReplyDelete