I am testing out MigLayout for a project, and I can't seem to figure out the MigLayout way of controlling the size of the whole panel which is being layed out. I am adapting the example in the MigLayout whitepaper. Also, I am writing in Python and using Jython rather than writing in Java. That said, here is my current code.
layout = MigLayout("fillx",
# Column constraints
"[right]rel[grow,fill]",
# Row constraints
"[]10[]10[]")
panel = JPanel(layout)
panel.add(JLabel("Enter size:"),
"")
panel.add(JTextField(""),
"wrap, width 150:250")
panel.add(JLabel("Enter weight:"),
"")
panel.add(JTextField(""),
"wrap, width 150:250")
panel.add(JButton("Ok"),
"span 2, align center, width 100:150")
The panel then goes into a JFrame for display. When I resize the frame, the controls resize nicely and obey their minimum sizes. However, there is no minimum size on the frame, nor does there seem to be any way to get to the real minimum size of the panel to set it for the frame. Asking for the panel's minimum size returns a size which, when set on the frame (plus insets), cuts off the button and half of the text fields.
What I want is to be able to set the minimum size for the frame (not hard-coded!) so that the panel fits and none of its controls are cut off. What is the best way to do this?