Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: How to clear previous menu in command prompt

  1. #1
    Xdawn90 is offline Learning Programmer
    Join Date
    Jul 2009
    Location
    in a fantasy world ...
    Posts
    54
    Rep Power
    0

    How to clear previous menu in command prompt

    Hi,

    I have a main menu with 3 options - 1, 2, and 3. When i enter 1 another menu will appear and the main menu will disappear. The menu will not stack one after another. How can I do that ? Can someone teach me how to do it ?

    Help is very much appreciated.

    Thanks.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,849
    Blog Entries
    4
    Rep Power
    49

    Re: How to clear previous menu in command prompt

    Quote Originally Posted by Xdawn90 View Post
    Hi,

    I have a main menu with 3 options - 1, 2, and 3. When i enter 1 another menu will appear and the main menu will disappear. The menu will not stack one after another. How can I do that ? Can someone teach me how to do it ?

    Help is very much appreciated.

    Thanks.
    Do you mean you're using command lines as menu or Java swing?

  4. #3
    Xdawn90 is offline Learning Programmer
    Join Date
    Jul 2009
    Location
    in a fantasy world ...
    Posts
    54
    Rep Power
    0

    Re: How to clear previous menu in command prompt

    Ya I am using command line. Is it possible to do that ? If yes please teach me how to do it.

    Thanks.

  5. #4
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,849
    Blog Entries
    4
    Rep Power
    49

    Re: How to clear previous menu in command prompt

    Test class
    Code:
    import java.awt.*;
    import java.awt.event.*;
     
    public class Test extends Frame implements WindowListener {
    	private static final long serialVersionUID = 1L;
    	private final TextArea TA = new TextArea
                ("", 25, 80, TextArea.SCROLLBARS_NONE);
        private final String NEWLINE = "" + '\n';
        
        public Test() {
            TA.setEditable(false);
            add(TA);
            setTitle("Test Application");
            setResizable(false);
            addWindowListener(this);
            pack();
            setVisible(true);
        }
        public void print(String s) {
            TA.append(s);
        }
        public void println(String s) {
            TA.append(s);
            TA.append(NEWLINE);
        }
        public void cls() {
            TA.setText("");
        }
        public void kill() {
            dispose();
        }
    	public void windowActivated(WindowEvent arg0) {
    	}
    	public void windowClosed(WindowEvent arg0) {
    	}
    	public void windowClosing(WindowEvent arg0) {
    	}
    	public void windowDeactivated(WindowEvent arg0) {	
    	}
    	public void windowDeiconified(WindowEvent arg0) {
    	}
    	public void windowIconified(WindowEvent arg0) {
    	}
    	public void windowOpened(WindowEvent arg0) {
    	}
    }
    Clearscreen
    Code:
    public class clearscreen {
    	 
    	public static void main(String[] args) {
    	        Test t = new Test();
    	        t.println("Hello World!");
    	        t.print("Same line ");
    	        t.println("Test");
    	        try {
    	            Thread.sleep(5000);
    	        } catch (InterruptedException e) 
    	        }
    	        t.cls();
    	        try {
    	            Thread.sleep(5000);
    	        } catch (InterruptedException e) {
    	        }
    	        t.kill();        
    	    }
    	}
    Try this...

  6. #5
    Xdawn90 is offline Learning Programmer
    Join Date
    Jul 2009
    Location
    in a fantasy world ...
    Posts
    54
    Rep Power
    0

    Re: How to clear previous menu in command prompt

    hmm ... I have try the code but this is not what i wanted it to be. Anyway, thanks very much for your kind help.

    I wanted to know how to create a menu (not in GUI) in a command prompt using java. For example, i have 4 options for my menu - a,b,c,d and when the user enter b and press enter, the main menu will disappear and menu b will appear. Is it possible to do that ?

    Sorry for my unclear description.

    Thanks.

  7. #6
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: How to clear previous menu in command prompt

    I think the commands "cls" clears the screen

  8. #7
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,849
    Blog Entries
    4
    Rep Power
    49

    Re: How to clear previous menu in command prompt

    Quote Originally Posted by BlaineSch View Post
    I think the commands "cls" clears the screen
    Yes indeed it does in c++
    However in java I have never seen with an IDE or whatever so command cls
    Am I stupid?

  9. #8
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: How to clear previous menu in command prompt

    He posted it in the java board but I think he misplaced it - he said "command prompt" which is the windows "command line" right? I was under the impression he just put this in the wrong place.

  10. #9
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,849
    Blog Entries
    4
    Rep Power
    49

    Re: How to clear previous menu in command prompt

    Quote Originally Posted by BlaineSch View Post
    He posted it in the java board but I think he misplaced it - he said "command prompt" which is the windows "command line" right? I was under the impression he just put this in the wrong place.
    I see...

  11. #10
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: How to clear previous menu in command prompt

    Wait im dumb... he said Java in one of his posts...

    /me runs away embarrassed

    <.<
    >.>

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with NOT accessing command prompt
    By Cyberinterion in forum General Programming
    Replies: 3
    Last Post: 05-09-2011, 07:17 AM
  2. SSH functionality with windows xp command prompt
    By Jalaska13 in forum Linux/Unix General
    Replies: 3
    Last Post: 11-03-2010, 05:50 AM
  3. Path in command prompt
    By Actor in forum General Programming
    Replies: 2
    Last Post: 06-13-2010, 10:23 PM
  4. Multiple command prompt windows?
    By fpod in forum C# Programming
    Replies: 2
    Last Post: 06-07-2008, 11:28 AM
  5. Command Prompt Program
    By Frantic in forum C# Programming
    Replies: 2
    Last Post: 07-20-2007, 02:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

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