jdraw.framework
Interface Handle


public interface Handle

Handles are used to change a figure by direct manipulation. Handles know their owning figure and they provide methods to ask the handle's bounds and to track changes.

See Also:
Figure

Method Summary
 boolean contains(int x, int y)
          Tests if a point is contained in the handle.
 void dragInteraction(int x, int y, java.awt.event.MouseEvent e, jdraw.framework.DrawView v)
          Tracks a step of a started interaction.
 void draw(java.awt.Graphics g)
          Draws this handle.
 java.awt.Rectangle getBounds()
          Gets the bounding box of the handle.
 java.awt.Cursor getCursor()
          Returns a curser which should be displayed when the mouse is over the handle.
 jdraw.framework.Figure getOwner()
          Gets the handle's owner.
 void startInteraction(int x, int y, java.awt.event.MouseEvent e, jdraw.framework.DrawView v)
          Tracks the start of an interaction.
 void stopInteraction(int x, int y, java.awt.event.MouseEvent e, jdraw.framework.DrawView v)
          Tracks the end of a running interaction.
 

Method Detail

getOwner

public jdraw.framework.Figure getOwner()
Gets the handle's owner.

Returns:
the figure which owns the handle

getBounds

public java.awt.Rectangle getBounds()
Gets the bounding box of the handle. This result depends on the current position of the figure.

Returns:
bounds of handle

draw

public void draw(java.awt.Graphics g)
Draws this handle.


getCursor

public java.awt.Cursor getCursor()
Returns a curser which should be displayed when the mouse is over the handle. Signals the type of operation which can be performed using this handle.

A default implementation may return Cursor.getDefaultCursor().

Returns:
handle's Cursor

contains

public boolean contains(int x,
                        int y)
Tests if a point is contained in the handle.

Parameters:
x - x-coordinate of mouse position
y - y-coordinate of mouse position
Returns:
true, if coordinates are contained in the figure, false otherwise

startInteraction

public void startInteraction(int x,
                             int y,
                             java.awt.event.MouseEvent e,
                             jdraw.framework.DrawView v)
Tracks the start of an interaction. Usually, the position where an interaction starts is stored.

Parameters:
x - the x position where the interaction started
y - the y position where the interaction started

dragInteraction

public void dragInteraction(int x,
                            int y,
                            java.awt.event.MouseEvent e,
                            jdraw.framework.DrawView v)
Tracks a step of a started interaction.

Parameters:
x - the current x position
y - the current y position

stopInteraction

public void stopInteraction(int x,
                            int y,
                            java.awt.event.MouseEvent e,
                            jdraw.framework.DrawView v)
Tracks the end of a running interaction.

Parameters:
x - the current x position
y - the current y position