Java源码示例:org.jdesktop.swingx.JXHeader

示例1
@Override
protected void onPropertyChange( JXHeader h, String propertyName, Object oldValue, Object newValue ) {
	super.onPropertyChange( h, propertyName, oldValue, newValue );

	if( "iconPosition".equals( propertyName ) )
		scaleLayout( h );
}
 
示例2
private void scaleLayout( JXHeader header ) {
	if( UIScale.getUserScaleFactor() == 1f )
		return;

	LayoutManager layout = header.getLayout();
	if( !(layout instanceof GridBagLayout) )
		return;

	GridBagLayout gbl = (GridBagLayout) layout;
	for( Component c : header.getComponents() ) {
		GridBagConstraints cons = gbl.getConstraints( c );
		cons.insets = UIScale.scale( cons.insets );
		gbl.setConstraints( c, cons );
	}
}
 
示例3
@Override
protected void installComponents( JXHeader header ) {
	super.installComponents( header );

	scaleLayout( header );
}