Computer Science Canada

How to Clear screen?

Author:  jacklarry [ 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.

Author:  Tony [ 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.

Author:  HeavenAgain [ 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 Crying or Very sad VB or Java, and what window?

Author:  jacklarry [ 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

Author:  Euphoracle [ 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?

Author:  jacklarry [ Wed Oct 17, 2007 7:10 pm ]
Post subject:  RE:How to Clear screen?

no just writing...simple code..simply writing

Author:  Euphoracle [ 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.

Author:  OneOffDriveByPoster [ Wed Oct 17, 2007 9:59 pm ]
Post subject:  Re: How to Clear screen?

Could also try (for *nix)
Java:
System.out.print("\f");

Author:  HeavenAgain [ 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();

Author:  Shiro786 [ Thu Oct 18, 2007 1:33 pm ]
Post subject:  Re: How to Clear screen?

System.out.clear();

I'm pretty sure that

Author:  wtd [ 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


: