This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hey, I'm working on an interactive map project for a software engineering class. Our code is broken down into a control panel and the actual map. To progress through the years covered by our data, we're using a JSlider as a timeline. I've been trying to implement a 'play' button that when clicked steps through each year, but what I'm trying isn't working.
Inside the Button's actionPerformed() I call a play/pause method which animates the timeline like so: while(timeline.getValue() < timeline.getMaximum()){ timeline.setValue(timeline.getValue() 5); //jumps 5 years timeline.repaint(); try { Thread.sleep(1000); } catch(InterruptedException e) { e.printStackTrace(); } }
The problem is that this process runs for a couple seconds (while the sleeps execute) and then pop, the slider's at the end of the timeline. It seems like the repaint() there isn't getting called at all. I've tried something with run() and SwingUtilities.invokeLater() that I saw somewhere else, but with the same results. Help?
Subreddit
Post Details
- Posted
- 13 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnprogra...