@ -7,8 +7,6 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.form.layout.FRBorderLayout ;
import com.fr.design.form.layout.FRBorderLayout ;
import com.fr.general.ComparatorUtils ;
import com.fr.general.ComparatorUtils ;
import javax.swing.JOptionPane ;
import java.awt.BorderLayout ;
import java.awt.BorderLayout ;
import java.awt.Rectangle ;
import java.awt.Rectangle ;
@ -46,18 +44,27 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter {
Rectangle rectangle = creator . getBounds ( ) ;
Rectangle rectangle = creator . getBounds ( ) ;
//不能超出控件边界
//不能超出控件边界
if ( ComparatorUtils . equals ( constraints , BorderLayout . NORTH ) | | ComparatorUtils . equals ( constraints , BorderLayout . SOUTH ) ) {
if ( ComparatorUtils . equals ( constraints , BorderLayout . NORTH ) | | ComparatorUtils . equals ( constraints , BorderLayout . SOUTH ) ) {
int containerHeight = container . getHeight ( ) ;
return isBeyondMinConstraint ( rectangle . height , container . getHeight ( ) ) ;
if ( rectangle . height > containerHeight ) {
FineJOptionPane . showMessageDialog ( null , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Form_Beyond_Tablayout_Bounds" ) ) ;
return true ;
}
} else if ( ComparatorUtils . equals ( constraints , BorderLayout . EAST ) | | ComparatorUtils . equals ( constraints , BorderLayout . WEST ) ) {
} else if ( ComparatorUtils . equals ( constraints , BorderLayout . EAST ) | | ComparatorUtils . equals ( constraints , BorderLayout . WEST ) ) {
int containerWidth = container . getWidth ( ) ;
return isBeyondMinConstraint ( rectangle . width , container . getWidth ( ) ) ;
if ( rectangle . width > containerWidth ) {
FineJOptionPane . showMessageDialog ( null , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Form_Beyond_Tablayout_Bounds" ) ) ;
return true ;
}
}
}
return false ;
return false ;
}
}
/ * *
* 是否超出最小限制
*
* @param minConstraint 最小限制
* @param value 数值
* @return 是否超出最小限制
* /
private boolean isBeyondMinConstraint ( int minConstraint , int value ) {
if ( minConstraint > value ) {
FineJOptionPane . showMessageDialog ( null , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Form_Beyond_Tablayout_Bounds" ) ) ;
container . setSize ( container . getBackupBound ( ) . getSize ( ) ) ;
return true ;
} else {
return false ;
}
}
}
}