Stretchwickster
Programmer
Hi,
I'm writing an applet and I'm trying to set up a 10x10 grid of JButtons and a 10x10 grid of JLabels, using GridLayout (obviously!). Each JButton and JLabel contains a 10px x 10px ImageIcon, when i run the applet the buttons and labels are not square. I would like them to be 10px x 10px each so that they are the same size as the icon they are displaying. I have tried using the setSize method to no avail! It seems to take no notice of this:
LGrid[j] = new JLabel(icon);
LGrid[j].setSize(new Dimension(10, 10));
BGrid[j] = new JButton(icon);
BGrid[j].setSize(new Dimension(10, 10));
Your assistance would be GREATLY appreciated!! ;-)
I'm writing an applet and I'm trying to set up a 10x10 grid of JButtons and a 10x10 grid of JLabels, using GridLayout (obviously!). Each JButton and JLabel contains a 10px x 10px ImageIcon, when i run the applet the buttons and labels are not square. I would like them to be 10px x 10px each so that they are the same size as the icon they are displaying. I have tried using the setSize method to no avail! It seems to take no notice of this:
LGrid[j] = new JLabel(icon);
LGrid[j].setSize(new Dimension(10, 10));
BGrid[j] = new JButton(icon);
BGrid[j].setSize(new Dimension(10, 10));
Your assistance would be GREATLY appreciated!! ;-)