+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 10 of 17

Thread: How to clear previous menu in command prompt

  1. #1
    Newbie Xdawn90 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    28

    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. #2
    Code Warrior Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n's Avatar
    Join Date
    May 2008
    Location
    4chan.org/g/
    Age
    20
    Posts
    3,836
    Blog Entries
    4

    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?

    Hatsune Miku ~❤❤❤
    初音ミク。~❤❤❤

  3. #3
    Newbie Xdawn90 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    28

    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.

  4. #4
    Code Warrior Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n's Avatar
    Join Date
    May 2008
    Location
    4chan.org/g/
    Age
    20
    Posts
    3,836
    Blog Entries
    4

    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...

    Hatsune Miku ~❤❤❤
    初音ミク。~❤❤❤

  5. #5
    Newbie Xdawn90 is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    28

    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.

  6. #6
    Code Warrior BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch's Avatar
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Age
    20
    Posts
    2,223
    Blog Entries
    8

    Re: How to clear previous menu in command prompt

    I think the commands "cls" clears the screen

  7. #7
    Code Warrior Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n's Avatar
    Join Date
    May 2008
    Location
    4chan.org/g/
    Age
    20
    Posts
    3,836
    Blog Entries
    4

    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?

    Hatsune Miku ~❤❤❤
    初音ミク。~❤❤❤

  8. #8
    Code Warrior BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch's Avatar
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Age
    20
    Posts
    2,223
    Blog Entries
    8

    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.

  9. #9
    Code Warrior Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n has much to be proud of Turk4n's Avatar
    Join Date
    May 2008
    Location
    4chan.org/g/
    Age
    20
    Posts
    3,836
    Blog Entries
    4

    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...

    Hatsune Miku ~❤❤❤
    初音ミク。~❤❤❤

  10. #10
    Code Warrior BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch is a glorious beacon of light BlaineSch's Avatar
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Age
    20
    Posts
    2,223
    Blog Entries
    8

    Re: How to clear previous menu in command prompt

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

    /me runs away embarrassed

    <.<
    >.>

+ Reply to Thread
Page 1 of 2
1 2 LastLast

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. dropdown menu
    By hkp in forum HTML Programming
    Replies: 6
    Last Post: 08-20-2009, 10:35 AM
  2. Dynamic context menu coursing exception
    By zombee81 in forum Visual Basic Programming
    Replies: 0
    Last Post: 06-27-2009, 01:53 AM
  3. Windows Shortcut List - Saves Time
    By 2stamlers in forum The Lounge
    Replies: 6
    Last Post: 04-10-2008, 06:58 AM
  4. AJAX Drop down populating menu
    By SeR_Cyclops in forum MarketPlace
    Replies: 0
    Last Post: 01-08-2008, 09:26 PM
  5. Menu Item options.
    By aravot in forum easyContact
    Replies: 3
    Last Post: 12-13-2007, 02:27 PM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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