All Packages Class Hierarchy This Package Previous Next Index
Class macrolanguage.MouseManager
java.lang.Object
|
+----macrolanguage.MouseManager
- public class MouseManager
- extends Object
- implements MouseListener, MouseMotionListener
this class is a part of FreeFormEdit torn out to allow a more dynamic
design, rather than concentrating all the events into one class I removed
all the mouse events to a separate class.
ATTENTION:
most of the method in this class are deprecated. They were used in the previos article
but are no longer in use in this article.
-
client
-
-
lastMousePosition
-
-
MouseManager(FreeFormEdit)
- The constructor needs a pointer to it's FreeFormEdit owner
so it will be able to respond to it's events with callback
for methods.
-
calculateParentContainerXY(Component, Container, int, int)
- this method recives a component ,a container and an x,y coordinate.
-
calculateRelativePosition(Point, Component)
- this method recives a point and a component to which the point
is relative and calculates the same point relative to this Component.
-
componentDragged(MouseEvent)
- Called whenever a mouse gets dragged.
-
componentResized(MouseEvent)
- gets called when a resize operation occurs on a component.
-
mouseClicked(MouseEvent)
- required by the MouseListener interface.
-
mouseDragged(MouseEvent)
- This method is a part of the MouseMotionListener interface and is
called whenever a mouse is dragged.
-
mouseEntered(MouseEvent)
- required by the MouseMotionListener interface.
-
mouseExited(MouseEvent)
- required by the MouseMotionListener interface.
-
mouseMoved(MouseEvent)
- required by the MouseMotionListener interface.
-
mousePressed(MouseEvent)
- required by the MouseListener interface.
-
mouseReleased(MouseEvent)
- required by the MouseListener interface.
-
placeComponentOnNextClick(Component)
- places the component comp on the next click on the free form
edit surface.
lastMousePosition
private Point lastMousePosition
client
private FreeFormEdit client
MouseManager
MouseManager(FreeFormEdit client)
- The constructor needs a pointer to it's FreeFormEdit owner
so it will be able to respond to it's events with callback
for methods.
calculateParentContainerXY
private Point calculateParentContainerXY(Component relativeComponent,
Container owningContainer,
int x,
int y)
- this method recives a component ,a container and an x,y coordinate.
When a mouse event is recived we get a relative x,y coordinate to the
owning component and not the container, if we need an absolute position
relative to the owning container we need to use this method.
calculateRelativePosition
private Point calculateRelativePosition(Point pos,
Component c)
- this method recives a point and a component to which the point
is relative and calculates the same point relative to this Component.
componentDragged
private void componentDragged(MouseEvent ev)
- Called whenever a mouse gets dragged.
componentResized
private void componentResized(MouseEvent ev)
- gets called when a resize operation occurs on a component.
mouseClicked
public void mouseClicked(MouseEvent ev)
- required by the MouseListener interface.
When a mouse is clicked that could mean 2 things:
1. Selection of a component on the surface.
2. Dropping a new component onto the surface.
mouseDragged
public void mouseDragged(MouseEvent ev)
- This method is a part of the MouseMotionListener interface and is
called whenever a mouse is dragged.
This method abstracts the dragging and dropping of components
on the free form surface.
mouseEntered
public void mouseEntered(MouseEvent ev)
- required by the MouseMotionListener interface.
mouseExited
public void mouseExited(MouseEvent ev)
- required by the MouseMotionListener interface.
mouseMoved
public void mouseMoved(MouseEvent ev)
- required by the MouseMotionListener interface.
used to determin when to diplay the resize mouse pointer on the components.
mousePressed
public void mousePressed(MouseEvent ev)
- required by the MouseListener interface.
mouseReleased
public void mouseReleased(MouseEvent ev)
- required by the MouseListener interface.
The drop operation when dragging is implemented here.
placeComponentOnNextClick
public void placeComponentOnNextClick(Component comp)
- places the component comp on the next click on the free form
edit surface.
All Packages Class Hierarchy This Package Previous Next Index