Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

JButton using GIF Image inside JTable Cells, animating probs

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
reply
    Bookmark Topic Watch Topic
  • New Topic