updating a JLabel

hi,

i have created a matrix full of JLabel instances using the GridBagLayout (think of the minesweeper game surface). Each label can be clicked on and is updated by setting a number to the label. But now i have the problem, that the gui starts to resize the label and thus the surface is not a symetric matrix anymore.

I tried to set the font size smaller but the problem is the same.

How can i update the label withouth resizing it?

Thanks for any suggestions!

[494 byte] By [Cinimooda] at [2007-11-27 1:55:20]
# 1
why didn't you use JTable of JLabels ?
java_2006a at 2007-7-12 1:28:10 > top of Java-index,Desktop,Core GUI APIs...
# 2
You should probably be using a GridLayout, not GridBagLayout for a grid of components.> updated by setting a number to the label. When you create the labels you need to set a preferred size of the label equal to the "widest" number you intend to assign to the label.
camickra at 2007-7-12 1:28:10 > top of Java-index,Desktop,Core GUI APIs...
# 3
good suggestion - it works. of course - using a jtable might be a good idea too.Thanks for your answers.
Cinimooda at 2007-7-12 1:28:10 > top of Java-index,Desktop,Core GUI APIs...