Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 23rd, 2005, 8:05 PM   #1
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
Clear Screen in Java

how do i clear the screen in java?
Dark Flare Knight is offline   Reply With Quote
Old Jun 23rd, 2005, 9:29 PM   #2
EdSalamander
Programmer
 
EdSalamander's Avatar
 
Join Date: Dec 2004
Location: Tucson, AZ, USA
Posts: 80
Rep Power: 5 EdSalamander is on a distinguished road
Send a message via AIM to EdSalamander
If you mean the console, then I think you're outta luck. As far as I know, Java can't do anything more to affect the console than to send it strings via the System.out PrintStream. I'll look into it more (and you should too ), but in the meantime, you could just bump everything up out of view. Something like:

for(int i = 0; i < 30; i++){
  System.out.println();
}

It's not the cleanest of methods, but it should get the job done.. *shrugs*
__________________
I can pick my friends. And I can pick my nose. So, why can't I pick my friend's nose?
EdSalamander is offline   Reply With Quote
Old Jun 23rd, 2005, 9:46 PM   #3
EdSalamander
Programmer
 
EdSalamander's Avatar
 
Join Date: Dec 2004
Location: Tucson, AZ, USA
Posts: 80
Rep Power: 5 EdSalamander is on a distinguished road
Send a message via AIM to EdSalamander
Ok, so I discovered that it is possible, but it's very platform dependent. It involves sending certain strings to the console that tell it to clear. This might help:

http://www.rgagnon.com/javadetails/java-0047.html
__________________
I can pick my friends. And I can pick my nose. So, why can't I pick my friend's nose?
EdSalamander is offline   Reply With Quote
Old Jun 24th, 2005, 1:09 PM   #4
Dark Flare Knight
Hobbyist Programmer
 
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4 Dark Flare Knight is on a distinguished road
So is there any way to move the cursor back to the top of the program? so the next text would appear on the top?

if i use a for loop

EDIT

if i use hsa.Console, then moving the cursor is setCursor (x,y) where x is the coloumn and y is the row and clear (); clears the screen but my teacher recommends me to use System.out sommands rather than hsa.Console;

Last edited by Dark Flare Knight; Jun 24th, 2005 at 1:15 PM.
Dark Flare Knight is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:53 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC