Package docking

Class KeyEntryTextField

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, SwingConstants

public class KeyEntryTextField extends JTextField
Text field captures key strokes and notifies a listener to process the key entry.
See Also:
  • Constructor Details

    • KeyEntryTextField

      public KeyEntryTextField(int columns, KeyEntryListener listener)
      Construct a new entry text field.
      Parameters:
      columns - number of columns in the text field
      listener - listener that is notified when the a key is pressed
  • Method Details

    • getKeyStroke

      public KeyStroke getKeyStroke()
      Get the current key stroke
      Returns:
      the key stroke
    • setKeyStroke

      public void setKeyStroke(KeyStroke ks)
      Sets the current key stroke
      Parameters:
      ks - the new key stroke
    • parseKeyStroke

      public static String parseKeyStroke(KeyStroke ks)
      Converts the toString() form of the keyStroke, e.g., Ctrl-M is returned as "keyCode CtrlM-P" and we want it to look like: "Ctrl-M"
      Parameters:
      ks - the keystroke to parse
      Returns:
      the parse string for the keystroke
    • clearField

      public void clearField()