The Artima Developer Community
Sponsored Link

Java Answers Forum
Console mode clear screen...

5 replies on 1 page. Most recent reply: Apr 7, 2003 12:10 AM by eti

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
Richard Hiltbrunn

Posts: 3
Nickname: rhiltbrunn
Registered: Mar, 2003

Console mode clear screen... Posted: Apr 2, 2003 7:27 AM
Reply to this message Reply
Advertisement
Is there an easy way to clear the screen in console mode? I have been looking all over for something as easy as System.out.clearScreen(); but have not found anything so far. Any help would be appreciated.

Thanks,

Rich


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Console mode clear screen... Posted: Apr 2, 2003 11:33 AM
Reply to this message Reply
Since out is a stream, clearing its "screen" doesn't make sense.

What operating system are you using? I posted an RMI example that did this for Windows some time ago (you can find it by searching these forums - I don't remember whether it is in the current forum or the legacy one, but you can search both).

If you are on Linux (or Unix), I think it would be a snap to make the same RMI code work for that platform, as well (if the clrscr() call in conio.h is not the same, it is probably very similar). Then you just write a little wrapper to check what platform and use the appropriate RMI call.

Kishori Sharan

Posts: 211
Nickname: kishori
Registered: Feb, 2002

Re: Console mode clear screen... Posted: Apr 2, 2003 3:05 PM
Reply to this message Reply
What does "an RMI example" has to do with clearing console screen in any platform?????

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Console mode clear screen... Posted: Apr 2, 2003 4:38 PM
Reply to this message Reply
Oops, I meant JNI, again.

Richard Hiltbrunn

Posts: 3
Nickname: rhiltbrunn
Registered: Mar, 2003

Re: Console mode clear screen... Posted: Apr 4, 2003 11:37 AM
Reply to this message Reply
Thanks for the tip. Sorry I sound so ignorant...but I am! I'm a VB programmer just learning Java. Thanks for your patience.

Rich.

eti

Posts: 3
Nickname: amuthan
Registered: Apr, 2003

Re: Console mode clear screen... Posted: Apr 7, 2003 12:10 AM
Reply to this message Reply
write the following statements inside a method and call it whenever you want to clear the console

String clear="\n\n\n\n\n... 25 times"
System.out.println(clear);

I hope this may help you as of now.

Flat View: This topic has 5 replies on 1 page
Topic: Translate a timestamp to seconds? Previous Topic   Next Topic Topic: System.out, System.err to FileWriter

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use