posted 18 years ago
Hi,
I'm making a program that uses a 10 X 10 GridLayout in which each position on the grid is a certain JLabel with an image icon in it. I have made a command so that when you type a letter, it loads up a different image, and then, upon clicking on a certain position on your Grid, it will remove that JLabel and place the one you have there. I tried doing this simply by replacing the JLabel at that position but it didn't modify anything. So then, I removed the JLabel at that position from my JPanel itself and then want to add the new JLabel in it's place at that position. However, the GridLayout takes my newly added JLabel and plops it down at the bottom.
Is there anyway I can add a JLabel to my GridLayout at my desired position? Or, if that's not possible, how do i change a JLabel from one image to another without removing it and adding it to the program again?
Thanks, I'll offer more info as is needed.