Class ncsa.horizon.awt.Cursor
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.awt.Cursor

java.lang.Object
   |
   +----ncsa.horizon.awt.Cursor

public class Cursor
extends Object
A draggable cursor for a Component. This allows a distinction to be made between the cursor attached to a component and the cursor used by the windowing system. The cursor can be moved and placed by pressing the mouse button while the window system cursor is "inside" the component cursor, dragging it to a new location, and releasing the mouse button.

The Cursor neither generates nor receives events. It can be thought of as a simple decorational widget than knows its location and state, can draw itself given a graphics context, and can be manipulated and queried through method calls. It is the responsibility of the parent component to ask the Cursor to draw/redraw itself.


Variable Index

 o color
 o component
 o grabLoc
 o height
 o heightDec
 o heightInc
 o state
 o STATE_VISIBLE
 o style
 o STYLE_BOX
A box cursor.
 o STYLE_BULLSEYE
A box cursor with central dot.
 o STYLE_CROSS
A cross (plus-sign) cursor.
 o STYLE_DOT
A solid block cursor.
 o STYLE_OPENCROSS
A cross cursor with open hotspot.
 o STYLE_SPANNINGCROSS
An cross cursor that spans the display.
 o STYLE_TERMINUS
 o STYLE_USER_ICON
A monochrome user-supplied cursor.
 o STYLE_USER_PIXMAP
A fixed-color user-supplied cursor.
 o STYLE_X
An X-shaped cursor.
 o thickness
 o width
 o widthDec
 o widthInc
 o x
The x location of the cursor.
 o y
The y location of the cursor.

Constructor Index

 o Cursor()
Create a Cursor in the default style and size.
 o Cursor(Component)
Create a Cursor for a given component.
 o Cursor(int, int)
Create a Cursor with a given size and style.

Method Index

 o calcDimensions()
calculate convenience values for use by other methods.
 o drag(int, int)
Drag this cursor to a given location.
 o draw(Graphics)
Draw the cursor at its current location.
 o drop(int, int)
Drop this cursor.
 o getColor()
Get the color of this Cursor.
 o getStyle()
Get the style of this Cursor.
 o getThickness()
Get the current cursor line thickness.
 o grab()
Grab this cursor in preparation for dragging or placing.
 o hide()
Hide the cursor from view.
 o inside(int, int)
Determines if the specified (x,y) location is inside this component.
 o inside(int, int, int)
Determines if the specified (x,y) location is inside or close to this component.
 o isGrabbed()
Indicate whether the cursor has been grabbed.
 o isVisible()
Indicate whether the cursor is visible.
 o location()
The location of this Cursor in its parent's coordinate space.
 o move(int, int)
Move this Cursor to the coordinate (x,y) in the parent's coordinate space.
 o redraw()
Cause a redisplay of the cursor (by calling the component's repaint() method).
 o resize(Dimension)
Resize the Cursor to the width and height specified by the dimension argument.
 o resize(int, int)
Resize the Cursor to the width and height specified.
 o setColor(Color)
Set the color for this Cursor.
 o setComponent(Component)
Set the component to attach this Cursor to.
 o setStyle(int)
Set the style for this Cursor.
 o setThickness(int)
Set the line thickness to use.
 o show()
Show the cursor.
 o show(boolean)
If the boolean argument is true, makes the Cursor visible.
 o size()
Resize the Cursor to the width and height specified by the dimension

Variables

 o x
  public int x
The x location of the cursor.
 o y
  public int y
The y location of the cursor.
 o height
  protected int height
 o width
  protected int width
 o heightInc
  protected int heightInc
 o widthInc
  protected int widthInc
 o heightDec
  protected int heightDec
 o widthDec
  protected int widthDec
 o thickness
  protected int thickness
 o style
  protected int style
 o color
  protected Color color
 o state
  protected int state
 o component
  protected Component component
 o grabLoc
  protected Point grabLoc
 o STYLE_CROSS
  public final static int STYLE_CROSS
A cross (plus-sign) cursor.
 o STYLE_DOT
  public final static int STYLE_DOT
A solid block cursor.
 o STYLE_BOX
  public final static int STYLE_BOX
A box cursor.
 o STYLE_BULLSEYE
  public final static int STYLE_BULLSEYE
A box cursor with central dot.
 o STYLE_OPENCROSS
  public final static int STYLE_OPENCROSS
A cross cursor with open hotspot.
 o STYLE_SPANNINGCROSS
  public final static int STYLE_SPANNINGCROSS
An cross cursor that spans the display.
 o STYLE_X
  public final static int STYLE_X
An X-shaped cursor. (Not yet implemented-- awaiting richer graphics API.)
 o STYLE_USER_ICON
  public final static int STYLE_USER_ICON
A monochrome user-supplied cursor. (Not yet implemented-- awaiting richer graphics API.)
 o STYLE_USER_PIXMAP
  public final static int STYLE_USER_PIXMAP
A fixed-color user-supplied cursor. (Not yet implemented-- awaiting richer graphics API.)
 o STYLE_TERMINUS
  protected final static int STYLE_TERMINUS
 o STATE_VISIBLE
  protected final static int STATE_VISIBLE

Constructors

 o Cursor
  public Cursor()
Create a Cursor in the default style and size. The current default cursor is a small cross.
 o Cursor
  public Cursor(int _size,
                int _style)
Create a Cursor with a given size and style.
Parameters:
_size - The size of the cursor (height and width are equal)
_style - The style of the cursor
 o Cursor
  public Cursor(Component _component)
Create a Cursor for a given component.
Parameters:
_component - The component to attach the Cursor to.

Methods

 o calcDimensions
  protected void calcDimensions()
calculate convenience values for use by other methods.
 o draw
  public void draw(Graphics g)
Draw the cursor at its current location. It is the responsibility of the applet/application to draw the cursor at the appropriate times. This gives maximum flexibility for double buffering, etc.
Parameters:
The - Graphics context on which to draw the Cursor.
 o grab
  public void grab()
Grab this cursor in preparation for dragging or placing.
 o drag
  public void drag(int x,
                   int y)
Drag this cursor to a given location.
Parameters:
_x - the x coordinate.
_y - the y coordinate.
 o drop
  public void drop(int _x,
                   int _y)
Drop this cursor.
Parameters:
_x - The x coordinate.
_y - The y coordinate.
 o move
  public void move(int _x,
                   int _y)
Move this Cursor to the coordinate (x,y) in the parent's coordinate space. This calls the repaint() method of the Cursor's component, who is ultimately responsible for calling the Cursor's draw() method.
Parameters:
_x - the x coordinate
_y - the y coordinate
 o redraw
  protected void redraw()
Cause a redisplay of the cursor (by calling the component's repaint() method).
 o location
  public Point location()
The location of this Cursor in its parent's coordinate space.
Returns:
The location of this Cursor in its parent's coordinate space.
See Also:
move
 o hide
  public void hide()
Hide the cursor from view.
 o show
  public void show()
Show the cursor.
 o show
  public void show(boolean cond)
If the boolean argument is true, makes the Cursor visible. If false, makes the Cursor invisible.
Parameters:
cond - if true, show the Cursor; if false, hide the Cursor.
 o size
  public Dimension size()
Resize the Cursor to the width and height specified by the dimension
Returns:
The current size of this Cursor.
 o resize
  public void resize(Dimension _dim)
Resize the Cursor to the width and height specified by the dimension argument.
Parameters:
_dim - The new dimension of this Cursor.
 o resize
  public void resize(int _width,
                     int _height)
Resize the Cursor to the width and height specified.
Parameters:
_width - The new width of this Cursor.
_height - The new height of this Cursor.
 o inside
  public boolean inside(int _x,
                        int _y)
Determines if the specified (x,y) location is inside this component.
Parameters:
_x - The x coordinate
_y - The y coordinate
Returns:
true if the specified (x,y) location lies within this component; false otherwise.
See Also:
locate
 o inside
  public boolean inside(int _x,
                        int _y,
                        int _pad)
Determines if the specified (x,y) location is inside or close to this component.
Parameters:
_x - The x coordinate
_y - The y coordinate
_pad - The pad value. This amount is added to each side of the bounding box of the cursor for determining insideness.
Returns:
true if the specified (x,y) location lies within this component; false otherwise.
See Also:
locate
 o isVisible
  public boolean isVisible()
Indicate whether the cursor is visible.
Returns:
boolean true if this Cursor is showing; false if it is hidden.
See Also:
show
 o isGrabbed
  public boolean isGrabbed()
Indicate whether the cursor has been grabbed.
Returns:
boolean true if this Cursor has been grabbed; otherwise false
See Also:
grab, drop
 o setComponent
  public void setComponent(Component _component)
Set the component to attach this Cursor to.
Parameters:
_component - The component to attach the Cursor to.
 o setStyle
  public void setStyle(int _style)
Set the style for this Cursor.
Parameters:
_style - The style to use for the cursor.
 o getStyle
  public int getStyle()
Get the style of this Cursor.
Returns:
The style of the cursor.
 o setColor
  public void setColor(Color _color)
Set the color for this Cursor.
Parameters:
_color - The Color to use to draw the cursor.
 o getColor
  public Color getColor()
Get the color of this Cursor.
Returns:
The Color used to draw the cursor.
 o setThickness
  public void setThickness(int _thickness)
Set the line thickness to use. This controls the width of the lines that make up box- and cross-style cursors, and the size of the center portion of open- and bullseye-style cursors.
Parameters:
int - The thickness of the cursor elements.
 o getThickness
  public int getThickness()
Get the current cursor line thickness.
Returns:
The thicknes of the cursor elements.

All Packages  Class Hierarchy  This Package  Previous  Next  Index