removed FlatClientProperties.clientPropertyChoice()

This commit is contained in:
Karl Tauber
2020-11-05 18:35:36 +01:00
parent c67ba02839
commit 082e5842d0
2 changed files with 12 additions and 14 deletions

View File

@@ -640,14 +640,4 @@ public interface FlatClientProperties
Object value = c.getClientProperty( key ); Object value = c.getClientProperty( key );
return (value instanceof Color) ? (Color) value : defaultValue; return (value instanceof Color) ? (Color) value : defaultValue;
} }
static int clientPropertyChoice( JComponent c, String key, String... choices ) {
Object value = c.getClientProperty( key );
for( int i = 0; i < choices.length; i++ ) {
if( choices[i].equals( value ) )
return i;
}
return -1;
}
} }

View File

@@ -254,15 +254,23 @@ public class FlatButtonUI
(icon == null && text != null && ("...".equals( text ) || text.length() == 1)); (icon == null && text != null && ("...".equals( text ) || text.length() == 1));
} }
// same indices as in parameters to clientPropertyChoice()
static final int TYPE_OTHER = -1; static final int TYPE_OTHER = -1;
static final int TYPE_SQUARE = 0; static final int TYPE_SQUARE = 0;
static final int TYPE_ROUND_RECT = 1; static final int TYPE_ROUND_RECT = 1;
static int getButtonType( Component c ) { static int getButtonType( Component c ) {
return (c instanceof AbstractButton) if( !(c instanceof AbstractButton) )
? clientPropertyChoice( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_SQUARE, BUTTON_TYPE_ROUND_RECT ) return TYPE_OTHER;
: TYPE_OTHER;
Object value = ((AbstractButton)c).getClientProperty( BUTTON_TYPE );
if( !(value instanceof String) )
return TYPE_OTHER;
switch( (String) value ) {
case BUTTON_TYPE_SQUARE: return TYPE_SQUARE;
case BUTTON_TYPE_ROUND_RECT: return TYPE_ROUND_RECT;
default: return TYPE_OTHER;
}
} }
static boolean isHelpButton( Component c ) { static boolean isHelpButton( Component c ) {