Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 23-06-2007, 06:36 PM   #1 (permalink)
Mad and Furious
 
redhat's Avatar
 
Join Date: May 2006
Location: Visual Basic 6.0
Posts: 453
Default How to clear screen in Java?


Hi,
I am creating a project in Java for my std. 10th Boards...

I need to know how to clear(flush) the command prompt screen from a code.
Like its "clrscr()" in C.

Actually its a menu driven program and I need to clear the screen after an option is selected, to make clean space for the next menu...

waiting for a reply...........
redhat is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 23-06-2007, 07:37 PM   #2 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: How to clear screen in Java?

By default there is no function in Java that does this, cause its platform independent.

The only way to do so is to call up the CMD's 'cls' function and this thing makes the code messy and sometimes doesn't work out on the same window as your program. But anyway, the code for that'd be:

Code:
Runtime.getRuntime().exec("cmd cls");
Or maybe you can print a few blank lines via a loop to fake it. But trust me, thats way better than calling up the command's 'cls' and making your code messy all over.

Also, it isn't really that important to refresh the screen and start all over, just to make it look better. Instead, concentrate on your functionalities of the program.
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
Old 23-06-2007, 11:07 PM   #3 (permalink)
The No.1 Stupid
 
~Phenom~'s Avatar
 
Join Date: May 2005
Location: CYBERYARD
Posts: 1,708
Default Re: How to clear screen in Java?

^^yeah . I was also about to say:"If U cant make it , fake it." A year back , I also wanted to do the same as redhat and used blank lines in loops . I was not aware of the method qwerty said, donno if it really works.
__________________
n00b forever...
~Phenom~ is offline  
Old 24-06-2007, 12:25 PM   #4 (permalink)
Apprentice
 
Join Date: May 2004
Location: close to mah pc
Posts: 55
Default Re: How to clear screen in Java?

exactly... that's whay i did in my 10th standard project... create a new class (with a constructor) just having a loop that prints 30 new blank lines... so everytime you wanted to clear the screen just make an object of that class ..
bazigaar_no_1 is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Doubts ..pls clear up..! abyssman Hardware Q&A 2 29-05-2006 02:29 PM
How to clear this list? ~Phenom~ QnA (read only) 10 21-02-2006 03:49 PM
small screen of java games in 6600 :-(( esumitkumar Mobiles and Tablets 1 04-11-2005 02:21 AM
How to clear History freezer QnA (read only) 8 11-06-2005 08:44 AM

 
Latest Threads
- by Who
- by clmlbx
- by Tenida
- by clinton
- by gohan89
- by icebags

Advertisement




All times are GMT +5.5. The time now is 08:33 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2