edu.rice.cs.drjava.ui.config
Class ColorOptionComponent

java.lang.Object
  |
  +--edu.rice.cs.drjava.ui.config.OptionComponent
        |
        +--edu.rice.cs.drjava.ui.config.ColorOptionComponent

public class ColorOptionComponent
extends OptionComponent

Graphical form of a ColorOption.

Version:
$Id: ColorOptionComponent.java,v 1.11 2002/09/02 21:24:13 csreis Exp $

Field Summary
private  JButton _button
           
private  JTextField _colorField
           
private  Color _currentColor
           
private  boolean _isBackgroundColor
           
private  Color _newColor
           
private  JPanel _panel
           
 
Fields inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
_label, _option, _parent
 
Constructor Summary
ColorOptionComponent(ColorOption opt, String text, Frame parent)
          Main constructor for ColorOptionComponent.
ColorOptionComponent(ColorOption opt, String text, Frame parent, boolean isBackgroundColor)
          An alternate constructor, allowing the caller to specify whether this color is a background color.
 
Method Summary
private  void _updateField(Color c)
          Updates the component's field to display the given color.
 void chooseColor()
          Shows a color chooser dialog for picking a new color.
 JComponent getComponent()
          Return's this OptionComponent's configurable component.
 void setValue(Color value)
          Displays the given value.
 void setValue(Object x0)
          Sets the value that is currently displayed by this component.
 boolean updateConfig()
          Updates the config object with the new setting.
 
Methods inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
getLabel, getLabelText, getOption, resetToCurrent, resetToDefault, showErrorMessage, showErrorMessage
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_button

private JButton _button

_colorField

private JTextField _colorField

_panel

private JPanel _panel

_currentColor

private Color _currentColor

_newColor

private Color _newColor

_isBackgroundColor

private boolean _isBackgroundColor
Constructor Detail

ColorOptionComponent

public ColorOptionComponent(ColorOption opt,
                            String text,
                            Frame parent)
Main constructor for ColorOptionComponent.
Parameters:
opt - The ColorOption to display
text - The text to display in the label of the component
parent - The Frame displaying this component

ColorOptionComponent

public ColorOptionComponent(ColorOption opt,
                            String text,
                            Frame parent,
                            boolean isBackgroundColor)
An alternate constructor, allowing the caller to specify whether this color is a background color. If so, the button will display the color as its background.
Method Detail

updateConfig

public boolean updateConfig()
Updates the config object with the new setting.
Overrides:
updateConfig in class OptionComponent
Returns:
true if the new value is set successfully

setValue

public void setValue(Color value)
Displays the given value.

_updateField

private void _updateField(Color c)
Updates the component's field to display the given color.

getComponent

public JComponent getComponent()
Return's this OptionComponent's configurable component.
Overrides:
getComponent in class OptionComponent

chooseColor

public void chooseColor()
Shows a color chooser dialog for picking a new color.

setValue

public void setValue(Object x0)
Description copied from class: OptionComponent
Sets the value that is currently displayed by this component.
Overrides:
setValue in class OptionComponent