|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.awt.gdp.Controller | +--org.zaval.awt.gdp.CursorController
This cursor controller class can be used to control cursor type for the specified
target component. Use the controller according to the following:
The controller registers itself as MouseMotionListener and MouseListener listeners of
the target component to control cursor type.
setCursorInfo
method. The
cursor info defines cursor type for the target component depending on the mouse
pointer location.
addActionListener
and removeActionListener
methods
to listen when the cursor has been changed for the target component.
getCursorType
method to get current cursor type.
Constructor Summary | |
CursorController(java.awt.Component target)
Constructs a new cursor controller with the specified target component. |
|
CursorController(java.awt.Component target,
CursorInfo i)
Constructs a new cursor controller with the specified target component and the given cursor info. |
Method Summary | |
void |
addActionListener(java.awt.event.ActionListener l)
Adds the specified action listener. |
protected void |
changeCursor(int x,
int y)
The method checks if the cursor type has to be changed for the specified location relatively the target component and sets a new cursor type if it is necessary. |
int |
getCursorType()
Gets the current cursor type. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component. |
void |
mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a component (with no buttons no down). |
void |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component. |
protected void |
perform()
Performs an action event. |
void |
removeActionListener(java.awt.event.ActionListener l)
Removes the specified action listener. |
protected void |
restoreCursor()
Sets the cursor type. |
void |
setCursorInfo(CursorInfo i)
Sets the specified cursor info. |
protected void |
setCursorType(int type)
Sets the specified cursor type. |
protected void |
storeCursor()
Stores a current cursor type. |
protected void |
targetWasChanged(java.awt.Component n,
java.awt.Component o)
The method is called whenever the target component has been changed. |
Methods inherited from class org.zaval.awt.gdp.Controller |
getTarget, setTarget |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CursorController(java.awt.Component target)
target
- the specified target component.
public CursorController(java.awt.Component target, CursorInfo i)
target
- the specified target component.i
- the specified cursor info.
Method Detail |
public void setCursorInfo(CursorInfo i)
i
- the specified cursor info.
public void addActionListener(java.awt.event.ActionListener l)
l
- the specified action listener.
public void removeActionListener(java.awt.event.ActionListener l)
l
- the specified action listener.
public int getCursorType()
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
protected void changeCursor(int x, int y)
x
- the specified x cordinate relatively the target component.y
- the specified y cordinate relatively the target component.
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
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 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
protected void targetWasChanged(java.awt.Component n, java.awt.Component o)
targetWasChanged
in class Controller
n
- the specified new target component.o
- the specified old target component.
protected void perform()
protected void setCursorType(int type)
type
- the specified cursor type.
protected void storeCursor()
protected void restoreCursor()
storeCursor
method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |