com.abstractics.utils.swing
Class PopupTextFocusListener

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

public abstract class PopupTextFocusListener
extends java.lang.Object
implements java.awt.event.FocusListener

Abstract FocusListener that can be implemented to cause a popup box (similar to a tool tip) to appear below a component when focus is received in the component. Useful for adding context sensitive help or error message displays to a text component.

Version:
$Id: PopupTextFocusListener.java,v 1.2 2006/03/15 05:37:30 andyman99 Exp $
Author:
Andrew Lawrence, Copyright 2006 Abstractics, L.L.C., Licensed under the Apache License, Version 2.0

Constructor Summary
PopupTextFocusListener()
          Constructor to create a new object.
 
Method Summary
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
protected  MultilineLabel getPopupLabel()
           
protected abstract  java.lang.String getText(java.awt.Component comp)
          This method should be implemented to determine what text should show up in the popup text when triggered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopupTextFocusListener

public PopupTextFocusListener()
Constructor to create a new object.

Method Detail

getText

protected abstract java.lang.String getText(java.awt.Component comp)
This method should be implemented to determine what text should show up in the popup text when triggered. This method is called everytime just before the popup is displayed. So it is possible to vary the text based on the current context.

Parameters:
comp - The component that is triggering the popup text to occur. Supplied here for reference only.
Returns:
Return the text that should be shown in the popup text

focusGained

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

focusLost

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

getPopupLabel

protected final MultilineLabel getPopupLabel()
Returns:
Returns the MultilineLabel object that is being used for the popup text display. This allows customization (color, font, etc.) of the display if required.