Package org.jfree.ui

Class 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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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

      • 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.