Kathleen Angeles wrote:Look into the page below:
http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html
Threads and concurrency are something that you need to learn when your gui has some dynamism like yours.
The main thread could be busy doing the calculations and other non-gui stuff. the gui is choked and not given its own time to update itself. in short, the trick is to use 1 or more additional threads. e.g. let the main thread handle non-gui stuff. make threads that would do gui stuff, like update your slot machine..
Keeping in mind, of course, that
Swing is not thread-safe, which means you want your GUI activity to take place entirely on the "event dispatching thread," (which some people might think of as the thread you are calling "the main thread," in which case, having
other threads do GUI stuff would cause problems).