diff --git a/openide.awt/apichanges.xml b/openide.awt/apichanges.xml --- a/openide.awt/apichanges.xml +++ b/openide.awt/apichanges.xml @@ -50,6 +50,19 @@ AWT API + + + ColorComboBox for color selection. + + + + + + There's a new class ColorComboBox that can be used as color picker. + + + + TabbedPaneFactory can be subclassed. diff --git a/openide.awt/manifest.mf b/openide.awt/manifest.mf --- a/openide.awt/manifest.mf +++ b/openide.awt/manifest.mf @@ -2,5 +2,5 @@ OpenIDE-Module: org.openide.awt OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties AutoUpdate-Essential-Module: true -OpenIDE-Module-Specification-Version: 7.48 +OpenIDE-Module-Specification-Version: 7.49 diff --git a/openide.awt/src/org/openide/awt/Bundle.properties b/openide.awt/src/org/openide/awt/Bundle.properties --- a/openide.awt/src/org/openide/awt/Bundle.properties +++ b/openide.awt/src/org/openide/awt/Bundle.properties @@ -125,3 +125,21 @@ # either: default, never or always #NOI18N USE_MNEMONICS=default + +#ColorComboBox +Custom=Custom ... +Black=Black +Blue=Blue +Cyan=Cyan +Dark_Gray=Dark Gray +Gray=Gray +Green=Green +Light_Gray=Light Gray +Magenta=Magenta +Orange=Orange +Pink=Pink +Red=Red +White=White +Yellow=Yellow + +SelectColor=Select Color diff --git a/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.form b/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.form --- a/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.form +++ b/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.form @@ -1,4 +1,4 @@ - +
@@ -121,6 +121,9 @@ + + + @@ -128,6 +131,9 @@ + + + @@ -135,6 +141,9 @@ + + + diff --git a/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.java b/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.java --- a/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.java +++ b/options.editor/src/org/netbeans/modules/options/colors/AnnotationsPanel.java @@ -6,13 +6,12 @@ package org.netbeans.modules.options.colors; -import org.netbeans.modules.options.colors.spi.FontsColorsController; import java.awt.Color; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -34,6 +33,8 @@ import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import org.netbeans.api.editor.settings.EditorStyleConstants; +import org.netbeans.modules.options.colors.spi.FontsColorsController; +import org.openide.awt.ColorComboBox; import org.openide.awt.Mnemonics; import org.openide.util.NbBundle; @@ -42,7 +43,7 @@ * @author Jan Jancura */ public class AnnotationsPanel extends JPanel implements ActionListener, - PropertyChangeListener, FontsColorsController { + ItemListener, FontsColorsController { private ColorModel colorModel; private boolean listen = false; @@ -67,9 +68,6 @@ cbWaveUnderlined.getAccessibleContext ().setAccessibleDescription (loc ("AD_Wave_Underlined")); lCategories.getAccessibleContext ().setAccessibleName (loc ("AN_Categories")); lCategories.getAccessibleContext ().setAccessibleDescription (loc ("AD_Categories")); - ColorComboBox.init (cbForeground); - ColorComboBox.init (cbBackground); - ColorComboBox.init (cbWaveUnderlined); lCategories.setSelectionMode (ListSelectionModel.SINGLE_SELECTION); lCategories.setVisibleRowCount (3); lCategories.addListSelectionListener (new ListSelectionListener () { @@ -79,12 +77,9 @@ } }); lCategories.setCellRenderer (new CategoryRenderer ()); - cbForeground.addPropertyChangeListener (this); - ((JComponent)cbForeground.getEditor()).addPropertyChangeListener (this); - cbBackground.addPropertyChangeListener (this); - ((JComponent)cbBackground.getEditor()).addPropertyChangeListener (this); - cbWaveUnderlined.addPropertyChangeListener (this); - ((JComponent)cbWaveUnderlined.getEditor()).addPropertyChangeListener (this); + cbForeground.addItemListener(this); + cbBackground.addItemListener(this); + cbWaveUnderlined.addItemListener(this); lCategory.setLabelFor (lCategories); loc(lCategory, "CTL_Category"); @@ -107,9 +102,9 @@ lForeground = new javax.swing.JLabel(); lbackground = new javax.swing.JLabel(); lWaveUnderlined = new javax.swing.JLabel(); - cbForeground = new javax.swing.JComboBox(); - cbBackground = new javax.swing.JComboBox(); - cbWaveUnderlined = new javax.swing.JComboBox(); + cbForeground = new ColorComboBox(); + cbBackground = new ColorComboBox(); + cbWaveUnderlined = new ColorComboBox(); lCategory.setText(org.openide.util.NbBundle.getMessage(AnnotationsPanel.class, "CTL_Category")); // NOI18N @@ -187,9 +182,11 @@ changed = true; } - public void propertyChange (PropertyChangeEvent evt) { + @Override + public void itemStateChanged( ItemEvent e ) { + if( e.getStateChange() == ItemEvent.DESELECTED ) + return; if (!listen) return; - if (evt.getPropertyName () != ColorComboBox.PROP_COLOR) return; updateData (); } @@ -271,21 +268,21 @@ Vector annotations = getAnnotations(currentScheme); SimpleAttributeSet c = (SimpleAttributeSet) annotations.get(lCategories.getSelectedIndex()); - Color color = ColorComboBox.getColor(cbBackground); + Color color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbBackground ); if (color != null) { c.addAttribute(StyleConstants.Background, color); } else { c.removeAttribute(StyleConstants.Background); } - color = ColorComboBox.getColor(cbForeground); + color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbForeground ); if (color != null) { c.addAttribute(StyleConstants.Foreground, color); } else { c.removeAttribute(StyleConstants.Foreground); } - color = ColorComboBox.getColor(cbWaveUnderlined); + color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbWaveUnderlined ); if (color != null) { c.addAttribute(EditorStyleConstants.WaveUnderlineColor, color); } else { @@ -317,30 +314,21 @@ if (inheritedForeground == null) { inheritedForeground = Color.black; } - ColorComboBox.setInheritedColor(cbForeground, inheritedForeground); + ColorComboBoxSupport.setInheritedColor((ColorComboBox)cbForeground, inheritedForeground); Color inheritedBackground = (Color) defAs.getAttribute(StyleConstants.Background); if (inheritedBackground == null) { inheritedBackground = Color.white; } - ColorComboBox.setInheritedColor(cbBackground, inheritedBackground); + ColorComboBoxSupport.setInheritedColor((ColorComboBox)cbBackground, inheritedBackground); } // set values Vector annotations = getAnnotations (currentScheme); AttributeSet c = annotations.get (index); - ColorComboBox.setColor ( - cbForeground, - (Color) c.getAttribute (StyleConstants.Foreground) - ); - ColorComboBox.setColor ( - cbBackground, - (Color) c.getAttribute (StyleConstants.Background) - ); - ColorComboBox.setColor ( - cbWaveUnderlined, - (Color) c.getAttribute (EditorStyleConstants.WaveUnderlineColor) - ); + ColorComboBoxSupport.setSelectedColor( (ColorComboBox)cbForeground, (Color) c.getAttribute (StyleConstants.Foreground)); + ColorComboBoxSupport.setSelectedColor( (ColorComboBox)cbBackground, (Color) c.getAttribute (StyleConstants.Background)); + ((ColorComboBox)cbWaveUnderlined).setSelectedColor((Color) c.getAttribute (EditorStyleConstants.WaveUnderlineColor)); listen = true; } diff --git a/options.editor/src/org/netbeans/modules/options/colors/ColorValue.java b/options.editor/src/org/netbeans/modules/options/colors/ColorValue.java --- a/options.editor/src/org/netbeans/modules/options/colors/ColorValue.java +++ b/options.editor/src/org/netbeans/modules/options/colors/ColorValue.java @@ -97,6 +97,6 @@ } private static String loc (String key) { - return NbBundle.getMessage (ColorComboBox.class, key); + return NbBundle.getMessage (ColorComboBoxSupport.class, key); } } diff --git a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form --- a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form +++ b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form @@ -107,6 +107,9 @@ + + + @@ -114,6 +117,9 @@ + + + diff --git a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java --- a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java +++ b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java @@ -44,13 +44,12 @@ package org.netbeans.modules.options.colors; -import org.netbeans.modules.options.colors.spi.FontsColorsController; import java.awt.Color; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -71,6 +70,8 @@ import javax.swing.text.AttributeSet; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; +import org.netbeans.modules.options.colors.spi.FontsColorsController; +import org.openide.awt.ColorComboBox; import org.openide.awt.Mnemonics; import org.openide.util.NbBundle; @@ -78,7 +79,7 @@ * * @author Jan Jancura */ -public class HighlightingPanel extends JPanel implements ActionListener, PropertyChangeListener, FontsColorsController { +public class HighlightingPanel extends JPanel implements ActionListener, ItemListener, FontsColorsController { private ColorModel colorModel = null; private boolean listen = false; @@ -103,8 +104,6 @@ cbForeground.getAccessibleContext ().setAccessibleDescription (loc ("AD_Foreground_Chooser")); cbBackground.getAccessibleContext ().setAccessibleName (loc ("AN_Background_Chooser")); cbBackground.getAccessibleContext ().setAccessibleDescription (loc ("AD_Background_Chooser")); - ColorComboBox.init (cbForeground); - ColorComboBox.init (cbBackground); lCategories.setSelectionMode (ListSelectionModel.SINGLE_SELECTION); lCategories.setVisibleRowCount (3); lCategories.addListSelectionListener (new ListSelectionListener () { @@ -115,10 +114,8 @@ } }); lCategories.setCellRenderer (new CategoryRenderer ()); - cbForeground.addActionListener (this); - ((JComponent) cbForeground.getEditor ()).addPropertyChangeListener (this); - cbBackground.addActionListener (this); - ((JComponent) cbBackground.getEditor ()).addPropertyChangeListener (this); + cbForeground.addItemListener(this); + cbBackground.addItemListener (this); lCategory.setLabelFor (lCategories); loc (lCategory, "CTL_Category"); @@ -139,8 +136,8 @@ lCategories = new javax.swing.JList(); lForeground = new javax.swing.JLabel(); lBackground = new javax.swing.JLabel(); - cbBackground = new javax.swing.JComboBox(); - cbForeground = new javax.swing.JComboBox(); + cbBackground = new ColorComboBox(); + cbForeground = new ColorComboBox(); lCategory.setText(org.openide.util.NbBundle.getMessage(HighlightingPanel.class, "CTL_Category")); // NOI18N @@ -210,12 +207,12 @@ } @Override - public void propertyChange (PropertyChangeEvent evt) { + public void itemStateChanged( ItemEvent e ) { + if( e.getStateChange() == ItemEvent.DESELECTED ) + return; if (!listen) return; - if (ColorComboBox.PROP_COLOR.equals (evt.getPropertyName ())) { - updateData (); - changed = true; - } + updateData (); + changed = true; } @Override @@ -321,14 +318,14 @@ AttributeSet category = categories.get(lCategories.getSelectedIndex()); SimpleAttributeSet c = new SimpleAttributeSet(category); - Color color = ColorComboBox.getColor(cbBackground); + Color color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbBackground ); if (color != null) { c.addAttribute(StyleConstants.Background, color); } else { c.removeAttribute(StyleConstants.Background); } - color = ColorComboBox.getColor(cbForeground); + color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbForeground ); if (color != null) { c.addAttribute(StyleConstants.Foreground, color); } else { @@ -361,24 +358,18 @@ if (inheritedForeground == null) { inheritedForeground = Color.black; } - ColorComboBox.setInheritedColor(cbForeground, inheritedForeground); + ColorComboBoxSupport.setInheritedColor((ColorComboBox)cbForeground, inheritedForeground); Color inheritedBackground = (Color) defAs.getAttribute(StyleConstants.Background); if (inheritedBackground == null) { inheritedBackground = Color.white; } - ColorComboBox.setInheritedColor(cbBackground, inheritedBackground); + ColorComboBoxSupport.setInheritedColor((ColorComboBox)cbBackground, inheritedBackground); } // set values - ColorComboBox.setColor ( - cbForeground, - (Color) category.getAttribute (StyleConstants.Foreground) - ); - ColorComboBox.setColor ( - cbBackground, - (Color) category.getAttribute (StyleConstants.Background) - ); + ColorComboBoxSupport.setSelectedColor((ColorComboBox)cbForeground, (Color) category.getAttribute (StyleConstants.Foreground)); + ColorComboBoxSupport.setSelectedColor((ColorComboBox)cbBackground, (Color) category.getAttribute (StyleConstants.Background)); listen = true; } diff --git a/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.form b/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.form --- a/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.form +++ b/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.form @@ -219,6 +219,9 @@ + + + @@ -226,6 +229,9 @@ + + + @@ -240,6 +246,9 @@ + + + diff --git a/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java b/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java --- a/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java +++ b/options.editor/src/org/netbeans/modules/options/colors/SyntaxColoringPanel.java @@ -44,13 +44,14 @@ package org.netbeans.modules.options.colors; -import org.netbeans.modules.options.colors.spi.FontsColorsController; import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyEditor; @@ -83,8 +84,10 @@ import org.netbeans.api.editor.settings.FontColorNames; import org.netbeans.api.editor.settings.FontColorSettings; import org.netbeans.modules.options.colors.ColorModel.Preview; +import org.netbeans.modules.options.colors.spi.FontsColorsController; import org.openide.DialogDescriptor; import org.openide.DialogDisplayer; +import org.openide.awt.ColorComboBox; import org.openide.awt.Mnemonics; import org.openide.util.NbBundle; import org.openide.util.RequestProcessor; @@ -95,7 +98,7 @@ * @author Jan Jancura */ public class SyntaxColoringPanel extends JPanel implements ActionListener, - PropertyChangeListener, FontsColorsController { + PropertyChangeListener, FontsColorsController, ItemListener { private Preview preview; @@ -131,9 +134,6 @@ cbEffects.getAccessibleContext ().setAccessibleDescription (loc ("AD_Efects_Color_Chooser")); cbEffectColor.getAccessibleContext ().setAccessibleName (loc ("AN_Efects_Color")); cbEffectColor.getAccessibleContext ().setAccessibleDescription (loc ("AD_Efects_Color")); - ColorComboBox.init (cbBackground); - ColorComboBox.init (cbForeground); - ColorComboBox.init (cbEffectColor); cbLanguage.addActionListener (this); lCategories.setSelectionMode (ListSelectionModel.SINGLE_SELECTION); lCategories.setVisibleRowCount (3); @@ -149,11 +149,8 @@ tfFont.setEditable (false); bFont.addActionListener (this); bFont.setMargin (new Insets (0, 0, 0, 0)); - cbForeground.addActionListener (this); - ((JComponent)cbForeground.getEditor()).addPropertyChangeListener (this); - - cbBackground.addActionListener (this); - ((JComponent)cbBackground.getEditor()).addPropertyChangeListener (this); + cbForeground.addItemListener(this); + cbBackground.addItemListener(this); cbEffects.addItem (loc ("CTL_Effects_None")); cbEffects.addItem (loc ("CTL_Effects_Underlined")); @@ -162,8 +159,7 @@ cbEffects.getAccessibleContext ().setAccessibleName (loc ("AN_Effects")); cbEffects.getAccessibleContext ().setAccessibleDescription (loc ("AD_Effects")); cbEffects.addActionListener (this); - ((JComponent)cbEffectColor.getEditor()).addPropertyChangeListener (this); - cbEffectColor.addActionListener (this); + cbEffectColor.addItemListener(this); loc(bFont, "CTL_Font_button"); loc(lBackground, "CTL_Background_label"); @@ -208,10 +204,10 @@ lBackground = new javax.swing.JLabel(); lEffects = new javax.swing.JLabel(); lEffectColor = new javax.swing.JLabel(); - cbForeground = new javax.swing.JComboBox(); - cbBackground = new javax.swing.JComboBox(); + cbForeground = new org.openide.awt.ColorComboBox(); + cbBackground = new ColorComboBox(); cbEffects = new javax.swing.JComboBox(); - cbEffectColor = new javax.swing.JComboBox(); + cbEffectColor = new ColorComboBox(); tfFont = new javax.swing.JTextField(); bFont = new javax.swing.JButton(); @@ -355,9 +351,9 @@ public void actionPerformed (ActionEvent evt) { if (!listen) return; if (evt.getSource () == cbEffects) { + if (cbEffects.getSelectedIndex () == 0) + cbEffectColor.setSelectedItem( null ); cbEffectColor.setEnabled (cbEffects.getSelectedIndex () > 0); - if (cbEffects.getSelectedIndex () == 0) - ColorComboBox.setColor (cbEffectColor, null); updateData (); } else if (evt.getSource () == cbLanguage) { @@ -438,8 +434,6 @@ break; } } - } else if (ColorComboBox.PROP_COLOR.equals(evt.getPropertyName())) { - updateData(); } } @@ -610,22 +604,22 @@ wave = null, strikethrough = null; if (cbEffects.getSelectedIndex () == 1) - underline = ColorComboBox.getColor(cbEffectColor); + underline = ((ColorComboBox)cbEffectColor).getSelectedColor(); if (cbEffects.getSelectedIndex () == 2) - wave = ColorComboBox.getColor(cbEffectColor); + wave = ((ColorComboBox)cbEffectColor).getSelectedColor(); if (cbEffects.getSelectedIndex () == 3) - strikethrough = ColorComboBox.getColor(cbEffectColor); + strikethrough = ((ColorComboBox)cbEffectColor).getSelectedColor(); SimpleAttributeSet c = category != null ? new SimpleAttributeSet(category) : new SimpleAttributeSet(); - Color color = ColorComboBox.getColor(cbBackground); + Color color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbBackground ); if (color != null) { c.addAttribute(StyleConstants.Background, color); } else { c.removeAttribute(StyleConstants.Background); } - color = ColorComboBox.getColor(cbForeground); + color = ColorComboBoxSupport.getSelectedColor( (ColorComboBox)cbForeground ); if (color != null) { c.addAttribute(StyleConstants.Foreground, color); } else { @@ -724,7 +718,7 @@ bFont.setEnabled (false); cbEffects.setEnabled (false); cbForeground.setEnabled (false); - cbForeground.setSelectedItem (new ColorValue (null, null)); + ((org.openide.awt.ColorComboBox)cbForeground).setSelectedColor( null ); cbBackground.setEnabled (false); cbBackground.setSelectedItem (new ColorValue (null, null)); cbEffectColor.setEnabled (false); @@ -741,70 +735,46 @@ Color inheritedForeground = (Color) getDefault (currentLanguage, category, StyleConstants.Foreground); if (inheritedForeground == null) inheritedForeground = Color.black; - ColorComboBox.setInheritedColor (cbForeground, inheritedForeground); + ColorComboBoxSupport.setInheritedColor ((ColorComboBox)cbForeground, inheritedForeground); Color inheritedBackground = (Color) getDefault (currentLanguage, category, StyleConstants.Background); if (inheritedBackground == null) inheritedBackground = Color.white; - ColorComboBox.setInheritedColor (cbBackground, inheritedBackground); + ColorComboBoxSupport.setInheritedColor ((ColorComboBox)cbBackground, inheritedBackground); String font = fontToString (category); tfFont.setText (font); - ColorComboBox.setColor ( - cbForeground, - (Color) category.getAttribute (StyleConstants.Foreground) - ); - ColorComboBox.setColor ( - cbBackground, - (Color) category.getAttribute (StyleConstants.Background) - ); + ColorComboBoxSupport.setSelectedColor( (ColorComboBox)cbForeground, (Color) category.getAttribute (StyleConstants.Foreground)); + ColorComboBoxSupport.setSelectedColor( (ColorComboBox)cbBackground, (Color) category.getAttribute (StyleConstants.Background)); if (category.getAttribute (StyleConstants.Underline) != null) { cbEffects.setSelectedIndex (1); cbEffectColor.setEnabled (true); - ColorComboBox.setColor ( - cbEffectColor, - (Color) category.getAttribute (StyleConstants.Underline) - ); + ((ColorComboBox)cbEffectColor).setSelectedColor((Color) category.getAttribute (StyleConstants.Underline)); } else if (category.getAttribute (EditorStyleConstants.WaveUnderlineColor) != null) { cbEffects.setSelectedIndex (2); cbEffectColor.setEnabled (true); - ColorComboBox.setColor ( - cbEffectColor, - (Color) category.getAttribute (EditorStyleConstants.WaveUnderlineColor) - ); + ((ColorComboBox)cbEffectColor).setSelectedColor((Color) category.getAttribute (EditorStyleConstants.WaveUnderlineColor)); } else if (category.getAttribute (StyleConstants.StrikeThrough) != null) { cbEffects.setSelectedIndex (3); cbEffectColor.setEnabled (true); - ColorComboBox.setColor ( - cbEffectColor, - (Color) category.getAttribute (StyleConstants.StrikeThrough) - ); + ((ColorComboBox)cbEffectColor).setSelectedColor((Color) category.getAttribute (StyleConstants.StrikeThrough)); } else if (getDefault (currentLanguage, category, StyleConstants.Underline) != null) { cbEffects.setSelectedIndex (1); cbEffectColor.setEnabled (true); - ColorComboBox.setColor ( - cbEffectColor, - (Color) getDefault (currentLanguage, category, StyleConstants.Underline) - ); + ((ColorComboBox)cbEffectColor).setSelectedColor((Color) getDefault (currentLanguage, category, StyleConstants.Underline)); } else if (getDefault (currentLanguage, category, EditorStyleConstants.WaveUnderlineColor) != null) { cbEffects.setSelectedIndex (2); cbEffectColor.setEnabled (true); - ColorComboBox.setColor ( - cbEffectColor, - (Color) getDefault (currentLanguage, category, EditorStyleConstants.WaveUnderlineColor) - ); + ((ColorComboBox)cbEffectColor).setSelectedColor((Color) getDefault (currentLanguage, category, EditorStyleConstants.WaveUnderlineColor)); } else if (getDefault (currentLanguage, category, StyleConstants.StrikeThrough) != null) { cbEffects.setSelectedIndex (3); cbEffectColor.setEnabled (true); - ColorComboBox.setColor ( - cbEffectColor, - (Color) getDefault (currentLanguage, category, StyleConstants.StrikeThrough) - ); + ((ColorComboBox)cbEffectColor).setSelectedColor((Color) getDefault (currentLanguage, category, StyleConstants.StrikeThrough)); } else { cbEffects.setSelectedIndex (0); cbEffectColor.setEnabled (false); @@ -1058,6 +1028,13 @@ convertALC.put("literal", "keyword"); //NOI18N convertALC.put("keyword-directive", "keyword"); //NOI18N } + + @Override + public void itemStateChanged( ItemEvent e ) { + if( e.getStateChange() == ItemEvent.DESELECTED ) + return; + updateData(); + } private static final class LanguagesComparator implements Comparator { @Override