Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making an IconImage spin on a JButton

 
Rugby Geek
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JButton that activates a process that can take some time to complete. I would like to have the image on the JButton spin while the process completes it's task. I have extended the JButton class to a SpinButton class, in order for me to be able to override it's paint() method. I am able to get the image to rotate, but not spin on a given axis. Additionally, there is some funky behavior occurring. Appears the renderer is colliding with other adjacent JButtons images. Any help would be appreciated.
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rugby,
I haven't had much time to mess with this. But here is my first approach.

I got the middle.gif from the Sun Java 2 tutorial on button demo or something like that. It is almost square in size. I am not sure how this will work if your icon is not quite square.
Enjoy,
Manfred.
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Rugby Geek",
Thanks for participating here at the Ranch. However, the name you are using does not comply with the naming convention described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name (not fictitious monikers). Please log in with a new name which meets the requirements.
Thanks.
Sean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic