Hi as we know ,we can add one icon to the button
jButton1.setIcon(Icon c);
can we add a rotating image to the button?(text 3d) if yes,please help me with a simple code.thanks
Hi as we know ,we can add one icon to the button
jButton1.setIcon(Icon c);
can we add a rotating image to the button?(text 3d) if yes,please help me with a simple code.thanks
The steps you'll need to follow broadly speaking are:
JButton
and override paintComponent(Graphics)
to apply a new Image to the JButton (the next animation frame).javax.swing.Timer
to fire an ActionEvent
periodically (e.g. every 50ms), causing it to repaint the JButton.Are you sure you want to do this though? It might make your UI look like it was written in the mid-80s.
I'm not sure if I'm just been capt. obvious... but... can't you just get an animated GIF and control the timing on that? It seems a lot easier than controlling the entire animation by generating the graphics and all.