Package org.jfree.ui

Class JTextObserver

java.lang.Object
org.jfree.ui.JTextObserver
All Implemented Interfaces:
FocusListener, EventListener

public final class JTextObserver extends Object implements FocusListener
An observer that selects all the text when a field gains the focus.
  • Field Details

    • singleton

      private static JTextObserver singleton
      The singleton instance.
  • Constructor Details

    • JTextObserver

      private JTextObserver()
      Creates a new instance.
  • Method Details

    • getInstance

      public static JTextObserver getInstance()
      Returns the single instance.
      Returns:
      The single instance.
    • focusGained

      public void focusGained(FocusEvent e)
      Selects all the text when a field gains the focus.
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      e - the focus event.
    • focusLost

      public void focusLost(FocusEvent e)
      Deselects the text when a field loses the focus.
      Specified by:
      focusLost in interface FocusListener
      Parameters:
      e - the event.
    • addTextComponent

      public static void addTextComponent(JTextComponent t)
      Adds this instance as a listener for the specified text component.
      Parameters:
      t - the text component.
    • removeTextComponent

      public static void removeTextComponent(JTextComponent t)
      Removes this instance as a listener for the specified text component.
      Parameters:
      t - the text component.