com.abstractics.utils.swing
Class TextFieldFocusSelectsAll

java.lang.Object
  extended bycom.abstractics.utils.swing.TextFieldFocusSelectsAll
All Implemented Interfaces:
java.util.EventListener, java.awt.event.FocusListener

public class TextFieldFocusSelectsAll
extends java.lang.Object
implements java.awt.event.FocusListener

FocusListener for JTextComponents that will cause the text in the component to be selected when the component receives focus. This makes the text component more similar to web browser form behavior.

Version:
$Id: TextFieldFocusSelectsAll.java,v 1.1 2005/11/04 16:46:27 andrew Exp $
Author:
Andrew Lawrence, Copyright 2006 Abstractics, L.L.C., Licensed under the Apache License, Version 2.0

Field Summary
static TextFieldFocusSelectsAll INSTANCE
          Static instance of the TextFieldFocusSelectsAll object.
 
Constructor Summary
TextFieldFocusSelectsAll()
           
 
Method Summary
static void applyTo(javax.swing.text.JTextComponent textField)
          Convenience method to apply the listener to the given JTextComponent
 void focusGained(java.awt.event.FocusEvent e)
          When focus is gained, the text in the component is selected
 void focusLost(java.awt.event.FocusEvent e)
          No implementation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final TextFieldFocusSelectsAll INSTANCE
Static instance of the TextFieldFocusSelectsAll object.

Constructor Detail

TextFieldFocusSelectsAll

public TextFieldFocusSelectsAll()
Method Detail

applyTo

public static void applyTo(javax.swing.text.JTextComponent textField)
Convenience method to apply the listener to the given JTextComponent

Parameters:
textField -

focusGained

public void focusGained(java.awt.event.FocusEvent e)
When focus is gained, the text in the component is selected

Specified by:
focusGained in interface java.awt.event.FocusListener
See Also:
FocusListener.focusGained(java.awt.event.FocusEvent)

focusLost

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

Specified by:
focusLost in interface java.awt.event.FocusListener
See Also:
FocusListener.focusLost(java.awt.event.FocusEvent)