943,502 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 45282
  • Java RSS
Jun 5th, 2003
0

Some Simple Console App Questons (Java)

Expand Post »
1. How do you clear the screen in a console java app?

2. How do you input text in the console area? Is it something with System.in?

...There may be more later :-P
Moderator
Reputation Points: 322
Solved Threads: 28
The C# Man, Myth, Legend
Tekmaven is offline Offline
914 posts
since Feb 2002
Jan 14th, 2005
0

Re: Some Simple Console App Questons (Java)

1) I've never done this so I'm not too clear on this. I think you have to set some kind of system property and then you can get properties of the console, and use escape sequences to clear console.

2) public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello");
}
}

lol this question was posted like half a year ago, but ohh welll.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jan 15th, 2005
0

Re: Some Simple Console App Questons (Java)

Console applications should never clear the screen. They should not even assume they have sole control over the screen below the point they're started from (for example, another application running in the background may well interrupt them to write something to the output itself, this could be the JVM writing some error message for example).
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jan 16th, 2005
0

Re: Some Simple Console App Questons (Java)

Hi everyone,

The simple answer is you can't but you can do this, it's a rather stupid way but it works

Java Syntax (Toggle Plain Text)
  1.  
  2. void public clear ()
  3. {
  4. int i = 0;
  5.  
  6. for(i=0;i<300;i++)
  7. {
  8. System.out.println("\n");
  9. }
  10.  
  11. }

It does the trick for me

I hope this helped you

By the way do you know how to print the contents of a JTextPane??

Yours Sincerely

Richard West
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Looking for J2ME audio or video player
Next Thread in Java Forum Timeline: I've tried everything...setting font of selected text





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC