More flexible min/max/preferred width and height for components
At the moment there is not way to say to the layout managers that a JComponent should have a certain min/max/preferred width but no min/max/preferred height (that I know of anyway). This makes some kinds of layout managers hard to implement without resorting to layout context objects, which would be somewhat redundant.
Add (to JComponent):
<br /> setPreferredWidth(Integer w)<br /> setPreferredHeight(Integer h)</p> <p>setMinimumWidth(Integer w)<br /> setMinimumHeight(Integer h)</p> <p>settMaximumWidth(Integer w)<br /> setMaximumHeight(Integer h)<br />
(+ get versions of above.)
Null means 'unspecified' or 'whatever'.
Also add the interconnected versions:
<br /> Integer getPreferredWidth(int ifHeight)<br /> Integer getPreferredHeight(int ifWidth)</p> <p>Integer getMinimumWidth(int ifHeight)<br /> Integer getMinimumHeight(int ifWidth)</p> <p>Integer getMaximumWidth(int ifHeight)<br /> Integer getMaximumHeight(int ifWidth)<br />
It would open up for situations where, for instance, preferred height is a function of the preferred width. A text component for instance could answer the question 'What would be your preferred height given the width of 100 '.
Making this interact transparently with the current API is quite simple. It wouldn't break code that 'doesn't know' about this feature, yet new Layout Managers could be written that used them.