public Color[] getColors() { return ColorUtility.getPredefinedExcelColors(); }
private Object[] getSelection( final Class arrayType, final Class propertyEditorType ) { if ( String[].class.equals( arrayType ) ) { if ( propertyEditorType != null && PropertyEditor.class.isAssignableFrom( propertyEditorType ) ) { try { final PropertyEditor editor = (PropertyEditor) propertyEditorType.newInstance(); return editor.getTags(); } catch ( Throwable e ) { logger.error( "Unable to instantiate property editor.", e );// NON-NLS } } } else if ( Color[].class.equals( arrayType ) ) { return ColorUtility.getPredefinedExcelColors(); } return null; }
/** * Creates a new color combobox and populates it with the excel colors. */ public ColorComboBox() { final DefaultComboBoxModel model = new DefaultComboBoxModel( ColorUtility.getPredefinedExcelColors() ); model.insertElementAt( null, 0 ); model.setSelectedItem( null ); setModel( model ); setRenderer( new ColorCellRenderer() ); final int height1 = getPreferredSize().height; setMaximumSize( new Dimension( height1 * 4, height1 ) ); setFocusable( false ); setEditable( false ); }