Re: Clear Screen command



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.

--
Send e-mail to: darrell dot grainger at utoronto dot ca

.