public class HintManager
extends java.lang.Object
implements java.awt.event.FocusListener, java.awt.event.MouseListener
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
HintManager(java.lang.Object hintComponent)
Creates the hint manager.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final int MOUSE_EVENT_TYPE
public static final int FOCUS_EVENT_TYPE
protected static final java.lang.String hintClearText
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.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