![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4
![]() |
Clear Screen in Java
how do i clear the screen in java?
|
|
|
|
|
|
#2 |
|
Programmer
|
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? |
|
|
|
|
|
#3 |
|
Programmer
|
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? |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Mar 2005
Location: Canada
Posts: 113
Rep Power: 4
![]() |
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 12:15 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|