Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.togethersoft.openapi.util.ui
Class KeyStrokeFormat

    java.lang.Object
      |
      +--java.text.Format
            |
            +--com.togethersoft.openapi.util.ui.KeyStrokeFormat

public class KeyStrokeFormat
extends Format

This class is suited to format and parse Strings which represent KeyStrokes - a key being typed on the keyboard. It contains both a char code for the key and a modifier (alt, shift, ctrl, meta, or a combination). This class is a singleton.

Author:
  TogetherSoft

Method Summary
`StringBuffer` | `format(Object obj, StringBuffer toAppendTo, FieldPosition pos)` Formats Object to StringBuffer.
`StringBuffer` | `format(KeyStroke stroke, StringBuffer toAppendTo, FieldPosition pos)` Formats Object to StringBuffer.
`static KeyStroke` | `fromString(String s)` Formats String to KeyStroke.
`static KeyStrokeFormat` | `getInstance()` Returns the only instance of this KeyStrokeFormat.
`Object` | `parseObject(String source, ParsePosition status)` Parses a string to produce a KeyStroke.
`static String` | `toString(KeyStroke stroke)` Formats KeyStroke to String.

Methods inherited from class java.text.Format
`format, parseObject, clone`

Methods inherited from class java.lang.Object
`getClass, hashCode, equals, toString, notify, notifyAll, wait, wait, wait, finalize`

Method Detail

### format

    public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)

  Formats Object to StringBuffer.
  Parameters:
    obj - Object to be formatted
    toAppendTo - StringBuffer to which formatted Object is to be appended
    pos
  Returns: StringBuffer which contains formatted Object
  Throws:
    IllegalArgumentException - if given Object is not an instance of KeyStroke

### format

    public StringBuffer format(KeyStroke stroke, StringBuffer toAppendTo, FieldPosition pos)

  Formats Object to StringBuffer.
  Parameters:
    stroke - KeyStroke to be formatted
    toAppendTo - StringBuffer to which formatted Object is to be appended
    pos
  Returns: StringBuffer which contains formatted Object
  Throws:
    IllegalArgumentException - if given KeyStroke contains unknown modifiers

### fromString

    public static KeyStroke fromString(String s)

  Formats String to KeyStroke.
  Parameters:
    s - String to be formatted
  Returns: if given String can be formatted returns KeyStroke, otherwise returns null

### getInstance

    public static KeyStrokeFormat getInstance()

  Returns the only instance of this KeyStrokeFormat.

### parseObject

    public Object parseObject(String source, ParsePosition status)

  Parses a string to produce a KeyStroke.
  Parameters:
    source - String to be parsed
    status - Specifies position in string from which parsing will be started; before calling, set status.index to the offset you want to start parsing at in the source.

### toString

    public static String toString(KeyStroke stroke)

  Formats KeyStroke to String.
  Parameters:
    stroke - KeyStroke to be formatted

Association Links

to Class com.togethersoft.openapi.util.ui.KeyStrokeFormat

to Class java.lang.String

to Class java.lang.String

Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD