• Post Reply Bookmark Topic Watch Topic
  • New Topic

repaint doesn't continue, no line but two point,why?  RSS feed

 
Forman Smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to page 384 of <head first java>, i modifyed the original code to below, i want to draw the line when i click the button.But the result is : just start point and the end point remain,no line show up.Why?

 
Knute Snortum
Sheriff
Posts: 3556
86
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing forum.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Forman and welcome to the Ranch! You're calling Thread#sleep(...) on the EDT, a big no-no. Learn about Swing Timers.

If you're not familiar with the EDT, look for the section of the same tutorial that deals with Concurrency in Swing.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!