Animation of Jpeg on a Grid Layout

Hi All,I am trying to move a picture of a car through the different cells of a grid layout(5x5).can some one help me how to do that ?I actually have to move is one a desired path as selected by the user but thats not my concern right now :)Thanks!!
[269 byte] By [j3000ta] at [2007-11-27 4:36:08]
# 1
GridLayout isn't meant to be used with empty cells. So either you should use dummy components to fill in the unoccupied cells with blank, either you should write your own LayoutManager/Component.
Dalzhima at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...
# 2

> GridLayout isn't meant to be used with empty cells.

> So either you should use dummy components to fill in

> the unoccupied cells with blank, either you should

> write your own LayoutManager/Component.

I am already using buttons with no text.i want to simulate a car moving through the different cells with a time delay.

j3000ta at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...
# 3
why use a grid layout at all?why not just have one big jpanel and draw the image atthe appropriate position?
TuringPesta at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...
# 4
> I am already using buttons with no text.i want to> simulate a car moving through the different cells> with a time delay.Huh? Do you want the image OVER the buttons?What are you doing?
TuringPesta at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...
# 5

> > I am already using buttons with no text.i want to

> > simulate a car moving through the different cells

> > with a time delay.

>

> Huh? Do you want the image OVER the buttons?

> What are you doing?

I think he's using the buttons like labels to display the image, and he's changing which button shows the image. OP, you should be drawing the image with the graphics object like in reply 3, that'll be much easier I think.

hunter9000a at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...
# 6
It is a requirement for an assignment,this is just a small part of it
j3000ta at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...
# 7

> It is a requirement for an assignment,this is just a

> small part of it

Ok, well then, each time the timer fires, change the button that's currently displaying to image so it's displaying nothing. Figure out which button needs to display it next based on the direction of movement. Set the new button's image.

hunter9000a at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...
# 8
If you want to render over a JPanel's children, you could override paintChildren and do it there, or use a JLayeredPane instead, with a transparent component that renders the image, or just use the JButton's icon property, if that suffices.
Hippolytea at 2007-7-12 9:46:17 > top of Java-index,Java Essentials,Java Programming...