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.
Ya I am using command line. Is it possible to do that ? If yes please teach me how to do it.
Thanks.
Test class
ClearscreenCode: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) { } }
Try this...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(); } }
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.
I think the commands "cls" clears the screen
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.
Wait im dumb... he said Java in one of his posts...
/me runs away embarrassed
<.<
>.>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks