de.unibi.techfak.jpredictor.gui
Class MouseOverHintManager

java.lang.Object
  extended by de.unibi.techfak.jpredictor.gui.MouseOverHintManager
All Implemented Interfaces:
java.awt.event.MouseListener, java.util.EventListener

public class MouseOverHintManager
extends java.lang.Object
implements java.awt.event.MouseListener

This class is used, to add a hint for any number of components. If the mouse enters the area of one component the corresponding hint is set as text in the label given when constructing the class.


Field Summary
private  javax.swing.JLabel hintLabel
          The label which is set with the hint.
private  java.util.Map hintMap
          The map where the components and the corresponding hints are stored.
 
Constructor Summary
MouseOverHintManager(javax.swing.JLabel hintLabel)
          Simple Constructor.
 
Method Summary
 void addHintFor(java.awt.Component comp, java.lang.String hintText)
          Registers a component with its corresponding hint.
 void changeHintFor(java.awt.Component comp, java.lang.String hintText)
          Changes the hint for the given component to the new string.
private  java.lang.String getHintFor(java.awt.Component comp)
          Get the hint for the Component given.
 void mouseClicked(java.awt.event.MouseEvent e)
          That event is not processed.
 void mouseEntered(java.awt.event.MouseEvent e)
          Sets the corresponding hint text for a component, which area was entered by the mouse cursor.
 void mouseExited(java.awt.event.MouseEvent e)
          Clears the text in the label, if the mouse cursor exits a components area.
 void mousePressed(java.awt.event.MouseEvent e)
          That event is not processed.
 void mouseReleased(java.awt.event.MouseEvent e)
          That event is not processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hintMap

private java.util.Map hintMap
The map where the components and the corresponding hints are stored.


hintLabel

private javax.swing.JLabel hintLabel
The label which is set with the hint.

Constructor Detail

MouseOverHintManager

public MouseOverHintManager(javax.swing.JLabel hintLabel)
Simple Constructor.

Parameters:
hintLabel - The label to which the hints are sent.
Method Detail

addHintFor

public void addHintFor(java.awt.Component comp,
                       java.lang.String hintText)
Registers a component with its corresponding hint.

Parameters:
comp - The component for which the hint is registered.
hintText - The corresponding hint for the component.

changeHintFor

public void changeHintFor(java.awt.Component comp,
                          java.lang.String hintText)
Changes the hint for the given component to the new string. Does nothing if the component is not yet registered.

Parameters:
comp - The component for which the hint is changed.
hintText - The new hint for the component.

getHintFor

private java.lang.String getHintFor(java.awt.Component comp)
Get the hint for the Component given. If the Component is a JLabel, the hint for the corresponding Component is returned. If comp is a TableHeader the hint for the corresponding table is returned.

Parameters:
comp - The Component to get the hint for.
Returns:
The hint as a String or null, if no hint was set.

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Sets the corresponding hint text for a component, which area was entered by the mouse cursor.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - The description of the event.

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Clears the text in the label, if the mouse cursor exits a components area.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - The description of the event.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
That event is not processed.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - The description of the event.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
That event is not processed.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - The description of the event.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
That event is not processed.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - The description of the event.