Prevent re-arrangement of component's position if some are invisible.
When making a dice game, I used a JPanel on which I placed 7 disabled radio buttons. Like this:
(I'm not sure how to display it with a courrier new font in this message).
My plan was for example if I roll a 1, I hide all radio buttons except the center one. If I roll a 2, I make visible the NW and SE button. If I roll a 6, I hide the center button and make the other buttons visible.
The problem I am having is that when I make my radio buttons invisible, the position of my radio buttons get re-arranged on my JPanel so that for example if I roll a 1, the middle Radio button finds itself completly in the top middle part of my panel. If I roll a 3 I don't get a nice diagonal line, the center button gets moved out of alignment.
How do I fix the position of my Radio buttons on the panel so that they never move regardless of if they are visible or not ?
I suppose I could use graphics function to draw the dice, but it seems to me that using radio buttons would be simpler.