public void constraintSouth ( JComponent target , JComponent top , JComponent bottom , int padV ) { if ( bottom == null ) { layout . putConstraint ( SpringLayout . SOUTH , target , - padV , SpringLayout . SOUTH , this ) ; } else { Spring a = Spring . sum ( Spring . constant ( - padV ) , layout . getConstraint ( SpringLayout . NORTH , bottom ) ) ; Spring b ; if ( top == null ) b = Spring . sum ( Spring . height ( target ) , layout . getConstraint ( SpringLayout . NORTH , this ) ) ; else b = Spring . sum ( Spring . height ( target ) , layout . getConstraint ( SpringLayout . SOUTH , top ) ) ; layout . getConstraints ( target ) . setConstraint ( SpringLayout . SOUTH , Spring . max ( a , b ) ) ; } }
Constrain it to the top of it s bottom panel and prevent it from getting crushed below it s size