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

java.lang.Object
  extended by edu.rice.cs.drjava.ui.config.OptionComponent<Color,JPanel>
      extended by edu.rice.cs.drjava.ui.config.ColorOptionComponent
All Implemented Interfaces:
Serializable

public class ColorOptionComponent
extends OptionComponent<Color,JPanel>

Graphical form of a ColorOption.

Version:
$Id: ColorOptionComponent.java 5232 2010-04-24 00:14:05Z mgricken $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
OptionComponent.ChangeListener
 
Field Summary
private  JButton _button
           
private  Color _color
           
private  JTextField _colorField
           
private  boolean _isBackgroundColor
           
private  boolean _isBoldText
           
private  JPanel _panel
           
 
Fields inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
_entireColumn, _guiComponent, _label, _labelText, _option, _parent
 
Constructor Summary
ColorOptionComponent(ColorOption opt, String text, SwingFrame parent)
          Main constructor for ColorOptionComponent.
ColorOptionComponent(ColorOption opt, String text, SwingFrame parent, boolean isBackgroundColor)
          An alternate constructor, allowing the caller to specify whether this color is a background color.
ColorOptionComponent(ColorOption opt, String text, SwingFrame parent, boolean isBackgroundColor, boolean isBoldText)
           
ColorOptionComponent(ColorOption opt, String text, SwingFrame parent, String description)
          Constructor that allows for a tooltip description.
ColorOptionComponent(ColorOption opt, String text, SwingFrame parent, String description, boolean isBackgroundColor)
          Constructor that allows for a tooltip description as well as whether or not this is a background color.
ColorOptionComponent(ColorOption opt, String text, SwingFrame parent, String description, boolean isBackgroundColor, boolean isBoldText)
          Constructor that allows for a tooltip description as well as whether or not this 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.
 void setDescription(String description)
          Sets the tooltip description text for this option.
 void setValue(Color value)
          Displays the given value.
 boolean updateConfig()
          Updates the config object with the new setting.
 
Methods inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
addChangeListener, getComponent, getEntireColumn, getLabel, getLabelText, getOption, notifyChangeListeners, removeChangeListener, resetToCurrent, resetToDefault, setComponent, setEntireColumn, showErrorMessage, showErrorMessage, useEntireColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_button

private JButton _button

_colorField

private JTextField _colorField

_panel

private JPanel _panel

_color

private Color _color

_isBackgroundColor

private boolean _isBackgroundColor

_isBoldText

private boolean _isBoldText
Constructor Detail

ColorOptionComponent

public ColorOptionComponent(ColorOption opt,
                            String text,
                            SwingFrame 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,
                            SwingFrame 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.


ColorOptionComponent

public ColorOptionComponent(ColorOption opt,
                            String text,
                            SwingFrame parent,
                            boolean isBackgroundColor,
                            boolean isBoldText)

ColorOptionComponent

public ColorOptionComponent(ColorOption opt,
                            String text,
                            SwingFrame parent,
                            String description)
Constructor that allows for a tooltip description.


ColorOptionComponent

public ColorOptionComponent(ColorOption opt,
                            String text,
                            SwingFrame parent,
                            String description,
                            boolean isBackgroundColor)
Constructor that allows for a tooltip description as well as whether or not this is a background color.


ColorOptionComponent

public ColorOptionComponent(ColorOption opt,
                            String text,
                            SwingFrame parent,
                            String description,
                            boolean isBackgroundColor,
                            boolean isBoldText)
Constructor that allows for a tooltip description as well as whether or not this is a background color.

Method Detail

setDescription

public void setDescription(String description)
Sets the tooltip description text for this option.

Specified by:
setDescription in class OptionComponent<Color,JPanel>
Parameters:
description - the tooltip text

updateConfig

public boolean updateConfig()
Updates the config object with the new setting.

Specified by:
updateConfig in class OptionComponent<Color,JPanel>
Returns:
true if the new value is set successfully

setValue

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

Specified by:
setValue in class OptionComponent<Color,JPanel>

_updateField

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


chooseColor

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