Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes JButton using GIF Image inside JTable Cells, animating probs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JButton using GIF Image inside JTable Cells, animating probs" Watch "JButton using GIF Image inside JTable Cells, animating probs" New topic
Author

JButton using GIF Image inside JTable Cells, animating probs

J. Insi
Ranch Hand

Joined: Aug 11, 2010
Posts: 90
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

Joined: May 03, 2008
Posts: 4523
    
    5

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).


luck, db
There are no new questions, but there may be new answers.
 
Consider Paul's rocket mass heater.
 
subject: JButton using GIF Image inside JTable Cells, animating probs
 
Similar Threads
JTable Problem
problem clicking jbuttons in jtable
Problem Updating Content Of JTable
Jtable uneditable cells in a specific table column (regardless of row)
JTable problem