File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes clrscr() in JAVA ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "clrscr() in JAVA ???" Watch "clrscr() in JAVA ???" New topic
Author

clrscr() in JAVA ???

Prosenjit Banerjee
Greenhorn

Joined: May 04, 2001
Posts: 20
Hello sirs,
Is there in methods built in JDK that will do the same task as clrscr() does in C++?
It not, can you write me a similar method, please ?
Thanks very much.
Mikael Jonasson
Ranch Hand

Joined: May 16, 2001
Posts: 158
Well, you could always just print a bunch of empty lines (like 30 or so). This will give the same efftekt I guess...
/Mike
Prosenjit Banerjee
Greenhorn

Joined: May 04, 2001
Posts: 20
Thanks Mr. Mikael Jonasson, but clearing the screen means not only clearing but also setting the cursor to the upper left position of the screen. What about that? Please suggest.
Thank you.
Prosenjit Banerjee
Greenhorn

Joined: May 04, 2001
Posts: 20
Someone please suggest me, whether the above (setting the character mode cursor at a particular position)is possible??
Please tell me. It is URGENT
Steven YaegerII
Ranch Hand

Joined: May 31, 2000
Posts: 182
I've no experience in your request, but I would think that the Windows API's would contain a CLS. You might check out JINI, to use the native C++ function.
I'd also post the same query in the Java in General(advanced) forum.
Good Luck
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Since the basic Windows DOS Command window does not emulate any specific cursor positioning algorithm I don't think there is a general way. If you were dealing with output to a terminal, or an X-windows display, etc. then there would be specific escape code sequences to position the cursor, etc etc. What sort of system are you trying to do this on?
Bill
Prosenjit Banerjee
Greenhorn

Joined: May 04, 2001
Posts: 20
Thanks to all who tried to answer me. But still I have no specific answer. Please help me.
As asked by Mr. William Brogden I am using Windows 98 and trying to run the program in the DOS shell.
Waiting for desired reply...
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
As near as I can tell there is no way to treat the MSDOS command prompt window in Win98 like a terminal with cursor positioning commands.

Bill

Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Clearing the screen on a Windows system and clearing the screen on a Unix box would be completely different. This is VERY OS dependant. Java does not do stuff that is OS dependant. The solution is to do the clear screen in a native language and blend it in using JNI.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Prosenjit Banerjee
Greenhorn

Joined: May 04, 2001
Posts: 20
Thank you very much for replying me. I think I got my answer. I have to use JNI. But since I do not know how to use it, I have wait some days more to learn it and then apply.
But I think Mr. William Brogden has an OS specific anwer. If really he has please let me know. I have already mentioned what kind of system I am using.
Thank you very much again.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Originally posted by William Brogden:
As near as I can tell there is no way to treat the MSDOS command prompt window in Win98 like a terminal with cursor positioning commands.

Bill

I think he already said that he DID NOT have a way on Win98.
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3254
    
    2
You may want to read this article. http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
What you need is the last part where the author shows how you can execute dos commands. It won't competely solve your problem but now have an idea to work on.
HTH,
Paul.
------------------
Get Certified, Guaranteed!
www.enthuware.com/jqplus

SCJP2 Resources, WebCompiler, Compare Mock Exam Results and More!
www.jdiscuss.com
Your guide to SCJD exam!
www.enthuware.com/jdevplus
[This message has been edited by Paul Anil (edited June 04, 2001).]


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4444
    
    5

A quick search on google.com for "ANSI cls" turned up these possible answers to your question
Junilu

[This message has been edited by JUNILU LACAR (edited June 04, 2001).]


Junilu - [How to Ask Questions] [How to Answer Questions]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Cool reference Junilu!
I wonder how much of the ANSI terminal control code standard is implemented. As I recall you could even set colors, but where to find a listing of the codes.....
Bill
Prosenjit Banerjee
Greenhorn

Joined: May 04, 2001
Posts: 20
Wow, finally I got the desired answer. Thank you so much Mr. Paul Anil and Mr. Junilu Lacar for the references offered.
I tried the following two codes in my MSDOS terminal under Win98.
Code #1 :
---------

Code #2 :
---------

I prefer the second code. Because it seems much faster than the first. But to make it working the ANSI device driver must be installed. I installed it by inserting the following line in my config.sys and then restarting the computer :
.
Thanks very much.
I LOVE JAVARANCH.COM.
Rashid Ali
Ranch Hand

Joined: Jan 16, 2001
Posts: 349
What an informative thread is this. All the replies are really appreciated too much.
Keep helping the others.
Thanks
Rashid
 
Don't get me started about those stupid light bulbs.
 
subject: clrscr() in JAVA ???
 
Similar Threads
clrscr() function?