Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JButton using GIF Image inside JTable Cells, animating probs

 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello guys!

I'm a bit worried while adding a JButton with GIF inside of it directly to the JTable Cells....
The adding process seems no problem at all. The problem itself is at the Cell... The Image is not animating.

I dig it from other resources telling me that,
This is the Renderer problem, instead of the JButton Problem.

I tested already if My JButton with GIF placed outside of the JTable, the image animates perfectly.
But if i sent 'em to the JTable Cells... the animation failed.

Thus, I hope somebody could help me out of this matter.

Below I write out the code of my JTable




And my custom JTableRenderer;



And the code that I used for adding JButton into the JTable is written below (works well);




For the Preview-1 at first (before adding):


And the Preview-2 (after adding):


You could see Preview-2 is not animating.
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please go through the evaluation comments in this bug report which will help you understand the concept of a renderer and why your images aren't animated.

Maybe you could adapt the ideas in Animated Icon Node to use with a JTable in place of JTree. It looks doable to me.

edit Also, a table model shouldn't have to contain GUI components. The renderer and editor are responsible for providing the visual component; the model should hold only state (i.e. data).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic