    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.

##

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

##

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

##

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

##

x

      public int x

  The x location of the cursor.

y

      public int y

  The y location of the cursor.

height

      protected int height

width

      protected int width

heightInc

      protected int heightInc

widthInc

      protected int widthInc

heightDec

      protected int heightDec

widthDec

      protected int widthDec

thickness

      protected int thickness

style

      protected int style

color

      protected Color color

state

      protected int state

component

      protected Component component

grabLoc

      protected Point grabLoc

STYLE_CROSS

      public final static int STYLE_CROSS

  A cross (plus-sign) cursor.

STYLE_DOT

      public final static int STYLE_DOT

  A solid block cursor.

STYLE_BOX

      public final static int STYLE_BOX

  A box cursor.

STYLE_BULLSEYE

      public final static int STYLE_BULLSEYE

  A box cursor with central dot.

STYLE_OPENCROSS

      public final static int STYLE_OPENCROSS

  A cross cursor with open hotspot.

STYLE_SPANNINGCROSS

      public final static int STYLE_SPANNINGCROSS

  An cross cursor that spans the display.

STYLE_X

      public final static int STYLE_X

  An X-shaped cursor. (Not yet implemented-- awaiting richer graphics API.)

STYLE_USER_ICON

      public final static int STYLE_USER_ICON

  A monochrome user-supplied cursor. (Not yet implemented-- awaiting richer graphics API.)

STYLE_USER_PIXMAP

      public final static int STYLE_USER_PIXMAP

  A fixed-color user-supplied cursor. (Not yet implemented-- awaiting richer graphics API.)

STYLE_TERMINUS

      protected final static int STYLE_TERMINUS

STATE_VISIBLE

      protected final static int STATE_VISIBLE

##

Cursor

      public Cursor()

  Create a Cursor in the default style and size. The current default cursor is a small cross.

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

Cursor

      public Cursor(Component _component)

  Create a Cursor for a given component.
  Parameters:
    _component - The component to attach the Cursor to.

##

calcDimensions

      protected void calcDimensions()

  calculate convenience values for use by other methods.

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.

grab

      public void grab()

  Grab this cursor in preparation for dragging or placing.

drag

      public void drag(int x,
                       int y)

  Drag this cursor to a given location.
  Parameters:
    _x - the x coordinate.
    _y - the y coordinate.

drop

      public void drop(int _x,
                       int _y)

  Drop this cursor.
  Parameters:
    _x - The x coordinate.
    _y - The y coordinate.

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

redraw

      protected void redraw()

  Cause a redisplay of the cursor (by calling the component's repaint() method).

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

hide

      public void hide()

  Hide the cursor from view.

show

      public void show()

  Show the cursor.

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.

size

      public Dimension size()

  Resize the Cursor to the width and height specified by the dimension
  Returns:
    The current size of this Cursor.

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.

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.

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

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

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

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

setComponent

      public void setComponent(Component _component)

  Set the component to attach this Cursor to.
  Parameters:
    _component - The component to attach the Cursor to.

setStyle

      public void setStyle(int _style)

  Set the style for this Cursor.
  Parameters:
    _style - The style to use for the cursor.

getStyle

      public int getStyle()

  Get the style of this Cursor.
  Returns:
    The style of the cursor.

setColor

      public void setColor(Color _color)

  Set the color for this Cursor.
  Parameters:
    _color - The Color to use to draw the cursor.

getColor

      public Color getColor()

  Get the color of this Cursor.
  Returns:
    The Color used to draw the cursor.

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.

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