|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.gui.HintManager
HintManager is a reusable class that provides an implementation for status-bar hints. Using it is straightforward. Just construct an instance of HintManager passing a hint component (JLabel or JTextField) instance that will be used to display the hints; call the method addHintFor to set a hint for each component you want; and call the method enableHints for the user interface top container (window, frame, dialog box, etc.) after adding all the components.
Field Summary | |
static int |
FOCUS_EVENT_TYPE
Focus event type. |
protected static java.lang.String |
hintClearText
The hint clear text. |
static int |
MOUSE_EVENT_TYPE
Mouse event type. |
Constructor Summary | |
HintManager(java.lang.Object hintComponent)
Creates the hint manager. |
Method Summary | |
protected java.lang.String |
addComponentHintText(java.lang.String hint,
java.awt.Component comp)
Adds help text for the specific component if needed. |
void |
addHintFor(java.awt.Component comp,
java.lang.String hintText)
Adds a hint for the component. |
void |
disableHints(java.awt.Component comp)
Disables hints for the component and all children. |
void |
enableHints(java.awt.Component comp,
int type)
Enable hints for the component and all children. |
void |
focusGained(java.awt.event.FocusEvent e)
|
void |
focusLost(java.awt.event.FocusEvent e)
|
protected java.lang.String |
getFullHintText(java.lang.String hint,
java.lang.String additionalHintText)
Gets the full hint text. |
protected java.lang.String |
getHintClearText()
Gets the hint clear text. |
protected java.lang.String |
getHintText(java.lang.String hint,
java.lang.String additionalHintText)
Gets the hint text. |
protected java.lang.String |
getHintText(java.lang.String hint,
java.lang.String additionalHintText,
boolean htmlFlag)
Gets the hint text. |
boolean |
isUseToolTipText()
Determines if tool tip text is used if no hints were found. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
setAddtionalHintTextColor(java.awt.Color color,
boolean boldFlag)
Sets the additional hint text color attributes. |
protected void |
setHint(java.lang.String hint)
Sets the hint on the hint component. |
void |
setUseToolTipText(boolean b)
Sets if tool tip text is used if no hints were found. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MOUSE_EVENT_TYPE
public static final int FOCUS_EVENT_TYPE
protected static final java.lang.String hintClearText
Constructor Detail |
public HintManager(java.lang.Object hintComponent) throws java.lang.Exception
hintComponent
- the hint component (JLabel or JTextField), which
must have a 'setText(String)' method.
java.lang.Exception
- if error.Method Detail |
public void addHintFor(java.awt.Component comp, java.lang.String hintText)
comp
- the component.hintText
- the hint text.public void disableHints(java.awt.Component comp)
comp
- the component.public void enableHints(java.awt.Component comp, int type)
comp
- the component.type
- the type of event to listen to, MOUSE_EVENT_TYPE for
mouse events and FOCUS_EVENT_TYPE for focus events.setUseToolTipText
public boolean isUseToolTipText()
public void setAddtionalHintTextColor(java.awt.Color color, boolean boldFlag)
color
- the color or null if none.boldFlag
- true for bold, false otherwise.public void setUseToolTipText(boolean b)
b
- true if tool tip text is used, false otherwise.enableHints
protected java.lang.String addComponentHintText(java.lang.String hint, java.awt.Component comp)
hint
- the hint text or null if none.comp
- the component.
protected java.lang.String getFullHintText(java.lang.String hint, java.lang.String additionalHintText)
hint
- the hint text.additionalHintText
- the additional hint text.
protected java.lang.String getHintText(java.lang.String hint, java.lang.String additionalHintText)
hint
- the hint text.additionalHintText
- the additional hint text or null if none.
protected java.lang.String getHintText(java.lang.String hint, java.lang.String additionalHintText, boolean htmlFlag)
hint
- the hint text.additionalHintText
- the additional hint text.htmlFlag
- true to use HTML text, false otherwise.
protected java.lang.String getHintClearText()
protected void setHint(java.lang.String hint)
hint
- the hint text or null if none.public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
public void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |