Re: Clear Screen command
- From: The Wogster <wogsterca@xxxxxxxx>
- Date: Tue, 31 May 2005 11:01:31 -0400
.. wrote:
On Sat, 28 May 2005, Frank Meyer wrote:
Chris,
public void clearScreen() { final int NUM_LINES = 100; // Just to be safe for (int i = 0; i < NUM_LINES; i++) System.out.println(); }
this does it - thanks :o)
If you don't have control over the number of lines on the display this is not a good solution.
On my system my terminal console can be resized to have 160 lines of text. This code would fail to clear the screen on my system. If my console was somehow restricted to 100 lines then this would be an acceptable solution.
Bottom line, don't make assumptions. Whenever you see something like "Just to be safe" it usually indicates that someone is making an assumption or that the solution is not the best solution.
I'd use this solution for an in-house tool or something I whipped up for personal use. I would not put this in something I shipped to a customer.
While that is true, perhaps there are better solutions:
1) Use a screen handling library like jcurses or jcurzez.
2) Ask the installer to specify a terminal type so you can send the right escape codes for the terminal in question.
3) Ask the installer to specify the escape code needed or the screen line limit.
W
.
- References:
- Clear Screen command
- From: Frank Meyer
- Re: Clear Screen command
- From: Chris Smith
- Re: Clear Screen command
- From: Frank Meyer
- Re: Clear Screen command
- From: "."
- Clear Screen command
- Prev by Date: Re: Java tools: Is eclipse everything what I need ?
- Next by Date: [Struts and FOP] : IllegalStateException
- Previous by thread: Re: Clear Screen command
- Next by thread: MIDP 1.0.3 support Mobile Media APIs
- Index(es):
Relevant Pages
|