org.zaval.awt.gdp
Class InsetsCursorInfo

java.lang.Object
  |
  +--org.zaval.awt.gdp.InsetsCursorInfo
All Implemented Interfaces:
CursorInfo

public class InsetsCursorInfo
extends java.lang.Object
implements CursorInfo

This class is an implementation of CursorInfo interface. The class defines different cursors types for nine areas of the specified component. The component area is devided as follow:
TLEFT TOP TRIGHT
LEFT CENTER RIGHT
BLEFT BOTTOM BRIGHT
The size of the cells are defined by a top, left, right and bottom indents.


Field Summary
static int BLEFT
           Defines bottom-left area type.
static int BOTTOM
           Defines bottom area type.
static int BRIGHT
           Defines bottom-right area type.
static int CENTER
           Defines center area type.
static int LEFT
           Defines left area type.
static int RIGHT
           Defines right area type.
static int TLEFT
           Defines top-left area type.
static int TOP
           Defines top area type.
static int TRIGHT
           Defines top-right area type.
 
Constructor Summary
InsetsCursorInfo()
           Constructs a new insets cursor info.
 
Method Summary
protected  boolean checkAreaType(int t)
           Tests if the specified area type is valid.
protected  int getAreaType(java.awt.Component c, int x, int y)
           Calculates and returns an area type for the specified component and the given location.
 int getCursorForArea(int t)
           Returns the cursor type for the specified area type.
 int getCursorType(java.awt.Component target, int x, int y)
           Returns the cursor type for the specified component and location relatively the component.
 void setCursorForArea(int t, int c)
           Binds the specified area with the specified cursor type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Defines left area type.

RIGHT

public static final int RIGHT
Defines right area type.

TOP

public static final int TOP
Defines top area type.

BOTTOM

public static final int BOTTOM
Defines bottom area type.

TLEFT

public static final int TLEFT
Defines top-left area type.

TRIGHT

public static final int TRIGHT
Defines top-right area type.

BLEFT

public static final int BLEFT
Defines bottom-left area type.

BRIGHT

public static final int BRIGHT
Defines bottom-right area type.

CENTER

public static final int CENTER
Defines center area type.
Constructor Detail

InsetsCursorInfo

public InsetsCursorInfo()
Constructs a new insets cursor info.
Method Detail

getCursorType

public int getCursorType(java.awt.Component target,
                         int x,
                         int y)
Returns the cursor type for the specified component and location relatively the component. The method using the specified location calculates what area contains the location and returns a cursor type that is bound with the area.
Specified by:
getCursorType in interface CursorInfo
Parameters:
target - the specified component.
x - the specified x coordinate relatively the component.
y - the specified y coordinate relatively the component.

setCursorForArea

public void setCursorForArea(int t,
                             int c)
Binds the specified area with the specified cursor type. Use one of static constants of the class as the area type. If the area type is undefined than the IllegalArgumentException will be thrown.
Parameters:
t - the specified area type.
c - the specified cursor type.

getCursorForArea

public int getCursorForArea(int t)
Returns the cursor type for the specified area type. If the area type is undefined than the IllegalArgumentException will be thrown.
Returns:
a cursor type.

getAreaType

protected int getAreaType(java.awt.Component c,
                          int x,
                          int y)
Calculates and returns an area type for the specified component and the given location.
Parameters:
c - the specified component.
x - the specified x coordinate relatively the component.
y - the specified y coordinate relatively the component.
Returns:
an area type.

checkAreaType

protected boolean checkAreaType(int t)
Tests if the specified area type is valid. The method checks if the area type equals one of the constants that are defined with the class.
Parameters:
t - the specified area type.
Returns:
true if the specified area type is valid; false otherwise.


Copyright © Zaval Creative Engineering Group, 2000-2002.
http://www.zaval.org