• Post Reply Bookmark Topic Watch Topic
  • New Topic

TwoButtons class (Head First Java) - Problems with change circle button

 
Ryan Blake
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code compiles and runs. However, the change circle button don't repaint the frame and the change text button changes the text and repaints. What did I do wrong? I altered the MyDrawPanel from what was in the book.

 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ryan, welcome to the Ranch! Your error is in line 25 of the code you posted.
 
Carey Brown
Bartender
Posts: 2257
28
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

See what widget you are adding a listener to.

Also, change label will cause a repaint because the panel size has changed.
 
Ryan Blake
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh sheesh!! Thanks Carey. I totally missed it.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:Also, change label will cause a repaint because the panel size has changed.


Other things will cause a repaint as well. For example try minimizing your application and then restoring it.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again
I shall move you to our GUIs forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!