Results 1 to 2 of 2
  1. #1
    cyzash is offline Member
    Join Date
    Feb 2010
    Posts
    6
    Rep Power
    0

    Default How to apply system cls in java...

    I want to use clear screen in my program bcoz it's look very messy
    but i don't know how.
    I try googling but its difficult to undrstand the tutorials..
    anybody?
    Java Code:
    public static void main(String[] args) {
            Scanner myOpt=new Scanner(System.in);
            Books b1= new Books();
            int optB=0;
            int updateOpt=0,x=0;
            do{
            
            System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
            System.out.println("WELCOME TO CyZAH && NADyA BOOKSTORES");
            System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            
            System.out.println("-1- Initialize BOOK's details");
            System.out.println("-2- Key in BOOK's details");
            System.out.println("-3- Update BOOK's details");
            System.out.println("-4- Display BOOK's details");
            System.out.println("-5- Finish BOOK's tasks");
            
            System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            
            System.out.println("==>Please choose your option:"); 
            optB=myOpt.nextInt();
            
            switch(optB){
                case 1: b1.intBooks();break;
                
                case 2: b1.enterBooks();
                        System.out.println("Input completed!");
                        System.out.println("###################");break;
                        
                case 3: b1.displayBookItem();
                        System.out.println("Please enter your option:");
                        updateOpt=myOpt.nextInt();
                        b1.updateBook(updateOpt);
                        System.out.println("Update completed"); break;
                        
                case 4: b1.displayBook();break;
                
                case 5: System.out.println("EXIT");break;
                
                default:System.out.println("Please try again ");
                       } 
             
            }while(optB!=5);
        }
    Last edited by cyzash; 02-20-2010 at 10:47 AM. Reason: code tag

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,763
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by cyzash View Post
    I want to use clear screen in my program bcoz it's look very messy
    but i don't know how.
    I try googling but its difficult to undrstand the tutorials..
    The 'cls' command is built-in in your cmd.exe (shell or command processor), so it isn't available as a separate executable program. Lucky enough, you can pass it as a parameter to cmd.exe: "cmd /c cls" and cmd.exe is an executable program. You can 'exec' it; read the API documentation for the Runtime class for details.

    kind regards,

    Jos

Similar Threads

  1. How to apply a patch (Call Matlab from Java)
    By Niroshan in forum Advanced Java
    Replies: 6
    Last Post: 07-09-2011, 03:55 AM
  2. Java GUI app used to apply XSLT to XML's
    By fawkes711 in forum XML
    Replies: 1
    Last Post: 12-09-2009, 09:59 AM
  3. how to apply gravity in tossing an egg
    By santhoshnanjappa in forum New To Java
    Replies: 1
    Last Post: 07-01-2009, 03:26 PM
  4. Kindly Help me to apply Stylesheet
    By AMATYA-CHANAKYA in forum Advanced Java
    Replies: 0
    Last Post: 03-18-2008, 07:30 AM
  5. Replies: 1
    Last Post: 08-07-2007, 08:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •