org.jfree.ui

## Class JTextObserver

- java.lang.Object
- - org.jfree.ui.JTextObserver

- All Implemented Interfaces:
    java.awt.event.FocusListener, java.util.EventListener

      public final class JTextObserver
      extends java.lang.Object
      implements java.awt.event.FocusListener

  An observer that selects all the text when a field gains the focus.
  Author:
    Thomas Morgner

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addTextComponent(javax.swing.text.JTextComponent t)` Adds this instance as a listener for the specified text component.
    `void` | `focusGained(java.awt.event.FocusEvent e)` Selects all the text when a field gains the focus.
    `void` | `focusLost(java.awt.event.FocusEvent e)` Deselects the text when a field loses the focus.
    `static JTextObserver` | `getInstance()` Returns the single instance.
    `static void` | `removeTextComponent(javax.swing.text.JTextComponent t)` Removes this instance as a listener for the specified text component.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static JTextObserver getInstance()

      Returns the single instance.
      Returns:
        The single instance.

    - #### focusGained

          public void focusGained(java.awt.event.FocusEvent e)

      Selects all the text when a field gains the focus.
      Specified by:
        `focusGained` in interface `java.awt.event.FocusListener`
      Parameters:
        `e` - the focus event.

    - #### focusLost

          public void focusLost(java.awt.event.FocusEvent e)

      Deselects the text when a field loses the focus.
      Specified by:
        `focusLost` in interface `java.awt.event.FocusListener`
      Parameters:
        `e` - the event.

    - #### addTextComponent

          public static void addTextComponent(javax.swing.text.JTextComponent t)

      Adds this instance as a listener for the specified text component.
      Parameters:
        `t` - the text component.

    - #### removeTextComponent

          public static void removeTextComponent(javax.swing.text.JTextComponent t)

      Removes this instance as a listener for the specified text component.
      Parameters:
        `t` - the text component.