This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes Timer Problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Timer Problems" Watch "Timer Problems" New topic

Timer Problems

jack pashley

Joined: Nov 21, 2012
Posts: 4
I have a zombie apocalypse simulator that I've been making. I'm having problems with making the text come up slow enough in my JTextArea (resultField) so that you can see it. All the program has to do is hold a loop still four about a second to half a second so you can read the variables as it increments. I have tried using Thread.sleep(500); but that just makes the GUI freeze for 500 seconds. So what i need the most is someone to help me set up a timer because I've looked all over the internet and none of the tutorials work for what I need (some of them didn't even work at all)

Loop where the code needs to go

Greg Brannon

Joined: Oct 24, 2010
Posts: 563
Put this project down for a sec and write a simple container with a text box that adds text driven by a javax.swing.Timer. Get it started and come back when you need help.

Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
jack pashley

Joined: Nov 21, 2012
Posts: 4
No it did not work

Paul Clapham

Joined: Oct 14, 2005
Posts: 19850

Didn't work? All went wrong? Yes, it's frustrating when a little thing like a semicolon torpedos your code, but for us to help you we need you to TellTheDetails. And read ItDoesntWorkIsUseless for more information. (Those are links; follow them.)
I agree. Here's the link:
subject: Timer Problems
It's not a secret anymore!