I'm new to java so sorry if this is a stupid question. I have a program
where I have 360 lines output. I need the screen to pause each time it
fills up. So far I made a for statement for lines 1-20, 20-45, etc. How
do I get the screen to pause at the end of each for statement? I've
been looking at Thread.sleep, but I'm unsure how to use it in my
program. This is what I have so far:
http://pastebin.com/447592
Roedy Green - 03 Dec 2005 20:58 GMT
>I'm new to java so sorry if this is a stupid question. I have a program
>where I have 360 lines output. I need the screen to pause each time it
>fills up.
see http://mindprod.com/jgloss/console.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
snewcrash - 03 Dec 2005 21:06 GMT
I looked there, and I'm not exactly sure what you're trying to point
out....
Chris Smith - 03 Dec 2005 21:06 GMT
> I'm new to java so sorry if this is a stupid question. I have a program
> where I have 360 lines output. I need the screen to pause each time it
> fills up. So far I made a for statement for lines 1-20, 20-45, etc. How
> do I get the screen to pause at the end of each for statement? I've
> been looking at Thread.sleep, but I'm unsure how to use it in my
> program.
Easy:
try
{
Thread.sleep(500);
} catch (InterruptedException e) { }

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
snewcrash - 03 Dec 2005 21:08 GMT
PERFECT! Just what I was looking for, thanks a lot. =)
snewcrash - 03 Dec 2005 22:29 GMT
Ok, so I made separate for statements to block off each section of
output. Is there a way to do this without having all these for
statements?
My code: http://pastebin.com/447685
mikkisingh@gmail.com - 03 Dec 2005 22:42 GMT
wouldn't a simple comparison of the counter work for u ? something like
...
for(counter =0 ; counter <....) {
//do ur stuff
if (counter == 20 || counter ==44 ....) {
Thread.sleep(....)
}
}
VisionSet - 03 Dec 2005 23:37 GMT
> wouldn't a simple comparison of the counter work for u ? something like
> ...
>
> for(counter =0 ; counter <....) {
> //do ur stuff
if (counter % 20 == 0){
> Thread.sleep(....)
> }
> }
--
Mike W
snewcrash - 04 Dec 2005 00:18 GMT
just what i was looking for. thanks for everyones help.
Monique Y. Mudama - 05 Dec 2005 23:49 GMT
> I'm new to java so sorry if this is a stupid question. I have a
> program where I have 360 lines output. I need the screen to pause
[quoted text clipped - 4 lines]
>
> http://pastebin.com/447592
I don't know your ultimate goal, but wouldn't it be better to wait on
user input every 20 lines or so?
asdfa
asdfa
fasafda
Press <Enter> to continue ...
That way, the user gets to decide how much time they need to digest
the data ...

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html