Is there some sort of listener in Java that indicates when a looped list scrolls off the screen? Or, as an alternative, is there a command that counts the lines available on a users screen? If so, could someone please let me know what they are?
I can't think of way to get the maximum number of lines for a generic terminal window in Java. Even worse for most cases besides DOS the user may resize the window.
I don't know what exactly your program should do but the simplest solution I have in mind is to combine your application with a standard tool like "more" to page the output directly in the operating system. Of course this solution is not very portable but it depends on your requirements if this is allowed.
Other possibilities could be a configurable screen height or to use the guaranteed minimum number of lines all possible terminal windows provide.
I think there's no better way if you want to use only pure Java. As I wrote a small enhancement could be to make the number of lines per page configurable for the user...
Is it important for your application to be very portable to different operating systems? With a one liner shell script which pipes the output through "more" or "less" you would be done on Linux and the application would always use the whole screen. A simple .bat file on Windows would make the job, too.
some of the other classmates seem to be doing that, but the assignment says to make it "hesitate", which unless in coding "hesitate" is different(which is always a posibility), I think the timer method best fullfills the needs of the assignment.