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