The short version: do I need to do something tricky to get JDialog's setMaximumSize() to work?
The full version: I've got a JDialog (layout manager: BorderLayout) which contains a scroll pane and a JPanel on the bottom with the commit buttons.
The scroll pane contains a JPanel which is built dynamically elsewhere in the system.
What I want is for the dialog to dynamically size itself around the JPanel up to a certain size, and then start growing scrollbars. This is, more or less, what happens by default, except the maximum size seems to be the size of my monitor.
I thought this is what the .setMaximumSize() method inherited from java.awt.Component did, but setting it doesn't seem to have any effect.
Setting the preferred size does has an effect - but then the dialog is always that size no matter what, which really isn't what I want.
(And the effects are the same if I set the maximum/preferred size properties on the scroll pane.)
Have I missed something tremendously obvious? Is there some wacky JDialog / BorderLayout / MaximumSize interaction I don't know about?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…