// we have more space than necessary; resize to give each at least
// preferred size
@Override
    public void resetToPreferredSizes() {
        Insets i = getInsets();
        if (getOrientation() == VERTICAL_SPLIT) {
            int h = getHeight() - i.top - i.bottom - getDividerSize();
            int topH = getTopComponent().getPreferredSize().height;
            int bottomH = getBottomComponent().getPreferredSize().height;
            int extraSpace = h - topH - bottomH;
            // we have more space than necessary; resize to give each at least
            // preferred size
            if (extraSpace >= 0) {
                setDividerLocation(i.top + topH
                                   + ((int) (extraSpace * getResizeWeight() + .5)));
            }
            // TODO implement shrinking excess space to ensure that one has
            // preferred and nothing more
        } else {
            int w = getWidth() - i.left - i.right - getDividerSize();
            int leftH = getLeftComponent().getPreferredSize().width;
            int rightH = getRightComponent().getPreferredSize().width;
            int extraSpace = w - leftH - rightH;
            // we have more space than necessary; resize to give each at least
            // preferred size
            if (extraSpace >= 0) {
                setDividerLocation(i.left + leftH
                                   + ((int) (extraSpace * getResizeWeight() + .5)));
            }
            // TODO implement shrinking excess space to ensure that one has
            // preferred and nothing more
        }
    }
int bottomH = getBottomComponent().getPreferredSize().height;
int extraSpace = h - topH - bottomH;
// we have more space than necessary; resize to give each at least
// preferred size
if (extraSpace >= 0) {
setDividerLocation(i.top + topH
@Override
public void resetToPreferredSizes() {
Insets i = getInsets();
if (getOrientation() == VERTICAL_SPLIT) {
int h = getHeight() - i.top - i.bottom - getDividerSize();
int topH = getTopComponent().getPreferredSize().height;
int bottomH = getBottomComponent().getPreferredSize().height;
int extraSpace = h - topH - bottomH;
// we have more space than necessary; resize to give each at least
// preferred size
if (extraSpace >= 0) {
setDividerLocation(i.top + topH
+ ((int) (extraSpace * getResizeWeight() + .5)));
}
// TODO implement shrinking excess space to ensure that one has
// preferred and nothing more
} else {
int w = getWidth() - i.left - i.right - getDividerSize();
int leftH = getLeftComponent().getPreferredSize().width;
int rightH = getRightComponent().getPreferredSize().width;
@Override
public void resetToPreferredSizes() {
Insets i = getInsets();
if (getOrientation() == VERTICAL_SPLIT) {
int h = getHeight() - i.top - i.bottom - getDividerSize();
int topH = getTopComponent().getPreferredSize().height;
int bottomH = getBottomComponent().getPreferredSize().height;
int extraSpace = h - topH - bottomH;
// we have more space than necessary; resize to give each at least
// preferred size
if (extraSpace >= 0) {
setDividerLocation(i.top + topH
+ ((int) (extraSpace * getResizeWeight() + .5)));
}
// TODO implement shrinking excess space to ensure that one has
// preferred and nothing more
} else {
int w = getWidth() - i.left - i.right - getDividerSize();
int leftH = getLeftComponent().getPreferredSize().width;
int rightH = getRightComponent().getPreferredSize().width;
int extraSpace = w - leftH - rightH;
// we have more space than necessary; resize to give each at least
// preferred size
if (extraSpace >= 0) {
setDividerLocation(i.left + leftH
+ ((int) (extraSpace * getResizeWeight() + .5)));
}
// TODO implement shrinking excess space to ensure that one has
// preferred and nothing more
}