aspose file tools*
The moose likes Java in General and the fly likes Making an IconImage spin on a JButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Making an IconImage spin on a JButton" Watch "Making an IconImage spin on a JButton" New topic
Author

Making an IconImage spin on a JButton

Rugby Geek
Greenhorn

Joined: Apr 23, 2002
Posts: 2
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

Joined: Jan 09, 2001
Posts: 1492
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

Joined: Nov 07, 2000
Posts: 621
"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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Making an IconImage spin on a JButton