Author |
Message |
jacklarry
|
Posted: Tue Oct 16, 2007 4:58 pm Post subject: How to Clear screen? |
|
|
hey,
I am having difficulty learning to clear the screen. Can anyone please help me? I have a main menu that asks for grocery items like whether they wanna buy it or return it, and then once they choice is picked, i want the main menu to be cleared away so that i can continue with the process. Can anyone please tell me wut the line for clearing the screen is for VB. Thank a lot once again. Oh, and can you tell me the code to close the window and exit the program....like if the choose to exit, then wut line shud i put...but plz help me with clearing the screen first. Thanks a million. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Tue Oct 16, 2007 5:43 pm Post subject: RE:How to Clear screen? |
|
|
Eh.. so is this for VB (what version?) or Java?
It would probably help to know how you're drawing to screen in the first place. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
Posted: Tue Oct 16, 2007 6:30 pm Post subject: RE:How to Clear screen? |
|
|
i tried answering 3 times, but the more i look at what you need, the more i got lost VB or Java, and what window? |
|
|
|
|
![](images/spacer.gif) |
jacklarry
|
Posted: Wed Oct 17, 2007 1:10 pm Post subject: RE:How to Clear screen? |
|
|
i am extremely sorry...i am talking about java not VB |
|
|
|
|
![](images/spacer.gif) |
Euphoracle
![](http://compsci.ca/v3/uploads/user_avatars/11170373664bf5f25f636f1.png)
|
Posted: Wed Oct 17, 2007 2:12 pm Post subject: RE:How to Clear screen? |
|
|
Are you referring to the screen as in drawing shapes, SWING, awt, etc. or to the console? |
|
|
|
|
![](images/spacer.gif) |
jacklarry
|
Posted: Wed Oct 17, 2007 7:10 pm Post subject: RE:How to Clear screen? |
|
|
no just writing...simple code..simply writing |
|
|
|
|
![](images/spacer.gif) |
Euphoracle
![](http://compsci.ca/v3/uploads/user_avatars/11170373664bf5f25f636f1.png)
|
Posted: Wed Oct 17, 2007 7:30 pm Post subject: RE:How to Clear screen? |
|
|
So the console then. Java isn't well known for giving the programmer access to the console. I'm not sure if this will work, but you can call the ANSI sequence:
System.out.print( ( ( char ) 27 ) + "[2J" );
Test it, see what happens. Also, you could try System.out.flush(); but I haven't the slightest idea if that'll work or not. |
|
|
|
|
![](images/spacer.gif) |
OneOffDriveByPoster
|
Posted: Wed Oct 17, 2007 9:59 pm Post subject: Re: How to Clear screen? |
|
|
Could also try (for *nix)
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
Posted: Wed Oct 17, 2007 10:10 pm Post subject: RE:How to Clear screen? |
|
|
if im not wrong, that will just print an empty line? "\f"? but thats a good way i guess, since there is no other way to clear the interaction just by coding? if thats the case, then just use System.out.println(); |
|
|
|
|
![](images/spacer.gif) |
Shiro786
|
Posted: Thu Oct 18, 2007 1:33 pm Post subject: Re: How to Clear screen? |
|
|
System.out.clear();
I'm pretty sure that |
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Thu Oct 18, 2007 3:42 pm Post subject: RE:How to Clear screen? |
|
|
The correct answer to "how do you clear the default text console?" is...
Don't |
|
|
|
|
![](images/spacer.gif) |
|