|
InputTipsManager V1.3 by Matthew Ford 2005/12/08 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectau.com.forward.inputTipsManager.InputTipsManager
public class InputTipsManager
Manages all the InputTips
in the application.
use
InputTipsManager.sharedInstance().showInputTip(jcomponent,tip);
to show the tip and
InputTipsManager.sharedInstance().hideInputTip();
to hide it.
The InputTip will also be removed when the jcomponent
looses
focus, or on next keystroke.
For more control use
InputTipsManager.sharedInstance().showInputTip(jcomponent,tipText,attachFocusListener, cellRect);
which lets you control if a focus and keyboard listener is attached and specify
the cell rectangle in a JTable to show the tip next to.
For example
Rectangle cellRect = table.getCellRect(selectedRow,selectedColumn, true);
String tip = "" + "Row "+selectedRow+" has been selected.";
InputTipsManager.sharedInstance().showInputTip(table,tip, false, cellRect);
Nested Class Summary | |
---|---|
protected class |
InputTipsManager.InputTipsKeyHandler
This class hides the inputtip on each keystroke press |
Constructor Summary | |
---|---|
protected |
InputTipsManager()
Constructor for the InputTipsManager object |
Method Summary | |
---|---|
void |
focusGained(java.awt.event.FocusEvent e)
To satisfy FocusListener Interface does nothing |
void |
focusLost(java.awt.event.FocusEvent e)
Hide InputTip when focus lost |
protected static java.awt.Frame |
frameForComponent(java.awt.Component component)
Get the Frame containing this component |
static java.lang.String |
getKeyText(char c)
Gets a display text for this char Has special handling for Backspace, Tab, Enter, Cancel, Escape, Delete and SYN (code 0x16) |
static java.lang.String |
getKeyText(int keyCode)
Gets a display text for this keycode e.g. |
static java.lang.String |
getKeyText(java.awt.event.KeyEvent e)
Gets a display text for the key in a KeyEvent |
void |
hideInputTip()
Hides the InputTip |
boolean |
isBeepEnabled()
Returns true if beeps are enabled. |
boolean |
isEnabled()
Returns true if InputTips are enabled. |
void |
setBeepEnabled(boolean flag)
Globally enables or disables the Beep on showInputTips (default enabled). |
void |
setEnabled(boolean flag)
Globally enables or disables the InputTips. |
static InputTipsManager |
sharedInstance()
Returns a shared InputTipsManager instance. |
void |
showInputTip(javax.swing.JComponent component,
java.lang.String tipText)
Shows an InputTip for this component. |
void |
showInputTip(javax.swing.JComponent component,
java.lang.String tipText,
boolean attachFocusListener,
java.awt.Rectangle cellRect)
Shows an InputTip for this component. |
void |
showInputTip(java.lang.String tipText)
Shows an InputTip for the component which currently has focus. If you know which component has focus use showInputTip(JComponent,String) insteadTip is removed when component looses focus or a key is pressed or when the hideInputTip() is called. This method runs an internal method on the SwingThread using invokeLater |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected InputTipsManager()
Method Detail |
---|
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
e
- focus eventpublic void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
e
- focus eventpublic void setBeepEnabled(boolean flag)
Toolkit.getDefaultToolkit().beep();
will be
called each time an InputTip is displayed.
flag
- true to enable beep on input tip display, false otherwisepublic boolean isBeepEnabled()
InputTipManger
will beep when displaying an
tippublic void setEnabled(boolean flag)
flag
- true to enable the inputtip, false otherwisepublic boolean isEnabled()
public void showInputTip(javax.swing.JComponent component, java.lang.String tipText, boolean attachFocusListener, java.awt.Rectangle cellRect)
component
- The JComponent to display the tip next totipText
- The tip to display, can be <HTML> textattachFocusListener
- true if should attach focus listener and key listener to hide tip on change in focus
false if listeners should not be attachedcellRect
- The rectangle representing the information the tip is to be displayed against.
If the component is a JTable scroll to make this rectangle visible.
Null if not needed.public void showInputTip(javax.swing.JComponent component, java.lang.String tipText)
component
- The JComponent to display the tip next totipText
- The tip to display, can be <HTML> textpublic void showInputTip(java.lang.String tipText)
showInputTip(JComponent,String)
instead
tipText
- The tip to display, can be <HTML> textpublic void hideInputTip()
public static InputTipsManager sharedInstance()
InputTipsManager
instance.
InputTipsManager
objectpublic static java.lang.String getKeyText(java.awt.event.KeyEvent e)
KeyEvent
e
- the KeyEvent
public static java.lang.String getKeyText(char c)
char
c
- the char to display
public static java.lang.String getKeyText(int keyCode)
keyCode
- the keycode to translate
protected static java.awt.Frame frameForComponent(java.awt.Component component)
component
- the component
|
©2005, Forward Computing and Control Pty. Ltd ACN 003 669 994 NSW Australia All Rights Reserved. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |