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

java.lang.Object
  |
  +--edu.rice.cs.drjava.ui.config.OptionComponent
        |
        +--edu.rice.cs.drjava.ui.config.KeyStrokeOptionComponent
All Implemented Interfaces:
Comparable

public class KeyStrokeOptionComponent
extends OptionComponent
implements Comparable

Graphical form of a KeyStrokeOption.

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

Inner Class Summary
private  class KeyStrokeOptionComponent.GetKeyDialog
          A dialog that allows the user to type in a keystroke to be bound to the action that was clicked.
 
Field Summary
private  JButton _button
           
private  KeyStroke _currentKey
           
private static KeyStrokeOptionComponent.GetKeyDialog _getKeyDialog
           
private  JTextField _keyField
           
static Hashtable _keyToKSOC
           
private  KeyStroke _newKey
           
private  JPanel _panel
           
private static int DIALOG_HEIGHT
           
 
Fields inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
_label, _option, _parent
 
Constructor Summary
KeyStrokeOptionComponent(KeyStrokeOption opt, String text, Frame parent)
           
 
Method Summary
private  void _setKeyStroke(KeyStroke ks)
          Sets the currently selected KeyStroke.
 int compareTo(Object o)
          Compares two KeyStrokeOptionComponents based on the text of their labels.
 JComponent getComponent()
          Return's this OptionComponent's configurable component.
 KeyStroke getConfigKeyStroke()
          Returns the KeyStroke current set in the Config settings.
 KeyStroke getKeyStroke()
          Returns the currently selected KeyStroke.
 void setValue(KeyStroke value)
          Displays the given value.
 void setValue(Object x0)
          Sets the value that is currently displayed by this component.
 String toString()
          Returns a custom string representation of this option 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, wait, wait, wait
 

Field Detail

DIALOG_HEIGHT

private static final int DIALOG_HEIGHT

_keyToKSOC

public static Hashtable _keyToKSOC

_button

private JButton _button

_keyField

private JTextField _keyField

_panel

private JPanel _panel

_getKeyDialog

private static KeyStrokeOptionComponent.GetKeyDialog _getKeyDialog

_currentKey

private KeyStroke _currentKey

_newKey

private KeyStroke _newKey
Constructor Detail

KeyStrokeOptionComponent

public KeyStrokeOptionComponent(KeyStrokeOption opt,
                                String text,
                                Frame parent)
Method Detail

toString

public String toString()
Returns a custom string representation of this option component.
Overrides:
toString in class Object

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(KeyStroke value)
Displays the given value.

compareTo

public int compareTo(Object o)
Compares two KeyStrokeOptionComponents based on the text of their labels.
Specified by:
compareTo in interface Comparable
Returns:
Comparison based on labels, or 1 if o is not a KeyStrokeOptionComponent

getKeyStroke

public KeyStroke getKeyStroke()
Returns the currently selected KeyStroke.

getConfigKeyStroke

public KeyStroke getConfigKeyStroke()
Returns the KeyStroke current set in the Config settings.

getComponent

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

_setKeyStroke

private void _setKeyStroke(KeyStroke ks)
Sets the currently selected KeyStroke.

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