My code compiles and runs, but I have a behavior problem with my Layout managers.
This is the creation of the JFrame which uses BorderLayout.
I use Border because I like/need the Quality that allows the center region to consume all new free space given by the window size.
public void buildBattleGridJFrame() { JScrollPane centerScroller = new JScrollPane(center,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); setTitle("BattleGrid"); setLayout(new BorderLayout()); add(centerScroller,BorderLayout.CENTER); setSize(100, 100); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); }
The scroller is intended to give me access to content not shown because of small window size.
And within this region I was hoping to use the GridLayout. I fill my GridLayout JPanel with smaller JPanels.
I give these smaller JPanels a size with "temp.setSize(100, 100);" but they end up taking what ever shape they want based on filling the grid region, rather then the scrollpane ever getting used to deal with oversizing. I want to start by trying ways to force my mini JPanels to behave in size making them unable to resize. Is there code for that?
EDIT:
I was curious how each of these worked beyond the obvious. it seems sometimes gui's just don't listen to size specifications
setSize(new Dimension(20, 20));
setPreferredSize(new Dimension(20, 20));
setMinimumSize(new Dimension(20, 20));
setMaximumSize(new Dimension(20, 20));
Thanks,
Jonathan