On my Java Swing application I have two components. On the left side is a navigation (JList) and on the right side is a JTable. I would like to leave the possibility to increase the size of the window, without increasing the size of both components.
The proportion of 50/50 is kept, through ought the whole sizing. I use GridLayout. Is this behavior rooted into the LayoutManager or is a property which has to be set?
GridbagLayoutwill allow you to achieve this. However, have you also considered using aJSplitPanewhere the left-hand side contains your navigation panel and the right hand side contains the table? You could configure it so that all additional space is allocated to the right hand side by callingsetResizeWeight(0.0). However, you still retain the flexibility of allowing the user to manually resize the navigation area if required. You also have the option to hide your navigation panel completely by callingsetOneTouchExpandable(true)on the split pane.