org.zaval.lw.gdp
Class InsetsCursorInfo
java.lang.Object
|
+--org.zaval.lw.gdp.InsetsCursorInfo
- All Implemented Interfaces:
- Cursorable
- public class InsetsCursorInfo
- extends java.lang.Object
- implements Cursorable
This class is an implementation of org.zaval.lw.Cursorable interface. The class defines
different cursors types for nine areas of the specified component. The component area
is divided 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 |
BRIGHT
Defines bottom-right area type. |
static int |
TLEFT
Defines top-left area type. |
static int |
TRIGHT
Defines top-right area type. |
|
Method Summary |
protected boolean |
checkAreaType(int t)
Tests if the specified area type is valid. |
protected int |
getAreaType(LwComponent 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(LwComponent 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 |
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.
InsetsCursorInfo
public InsetsCursorInfo()
- Constructs a new insets cursor info.
getCursorType
public int getCursorType(LwComponent target,
int x,
int y)
- Returns the cursor type for the specified component and location relatively the component.
The method calculates what area contains the point (x, y) and
returns a cursor type that is bound with the area.
- Specified by:
getCursorType in interface Cursorable
- 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. If the area type is undefined
than the IllegalArgumentException will be thrown.
- Parameters:
t - the specified area type. Use one of the following constants as the argument value:
LwToolkit.LEFT, LwToolkit.RIGHT, LwToolkit.TOP, LwToolkit.BOTTOM, LwToolkit.CENTER,
InsetsCursorInfo.TLEFT, InsetsCursorInfo.TRIGHT, InsetsCursorInfo.BLEFT, InsetsCursorInfo.BRIGHT.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(LwComponent 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 following constant:
LwToolkit.LEFT, LwToolkit.RIGHT, LwToolkit.TOP, LwToolkit.BOTTOM, LwToolkit.CENTER,
InsetsCursorInfo.TLEFT, InsetsCursorInfo.TRIGHT, InsetsCursorInfo.BLEFT, InsetsCursorInfo.BRIGHT
- Parameters:
t - the specified area type.- Returns:
true if the specified area type is valid; false otherwise.
|