public class ComponentMover extends MouseAdapter
| Constructor and Description |
|---|
ComponentMover()
Constructor for moving individual components.
|
ComponentMover(Class destinationClass,
Component... components)
Constructor to specify a Class of Component that will be moved when
drag events are generated on a registered child component.
|
ComponentMover(Component destinationComponent,
Component... components)
Constructor to specify a parent component that will be moved when drag
events are generated on a registered child component.
|
| Modifier and Type | Method and Description |
|---|---|
void |
deregisterComponent(Component... components)
Remove listeners from the specified component
|
Insets |
getDragInsets()
Get the drag insets
|
Insets |
getEdgeInsets()
Get the bounds insets
|
Dimension |
getSnapSize()
Get the snap size
|
boolean |
isAutoLayout()
Get the auto layout property
|
boolean |
isChangeCursor()
Get the change cursor property
|
void |
mouseDragged(MouseEvent e)
Move the component to its new location.
|
void |
mousePressed(MouseEvent e)
Setup the variables used to control the moving of the component:
source - the source component of the mouse event
destination - the component that will ultimately be moved
pressed - the Point where the mouse was pressed in the destination
component coordinates.
|
void |
mouseReleased(MouseEvent e)
Restore the original state of the Component
|
void |
registerComponent(Component... components)
Add the required listeners to the specified component
|
void |
setAutoLayout(boolean autoLayout)
Set the auto layout property
|
void |
setChangeCursor(boolean changeCursor)
Set the change cursor property
|
void |
setDragInsets(Insets dragInsets)
Set the drag insets.
|
void |
setEdgeInsets(Insets edgeInsets)
Set the edge insets.
|
void |
setSnapSize(Dimension snapSize)
Set the snap size.
|
mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelMovedpublic ComponentMover()
public ComponentMover(Class destinationClass, Component... components)
destinationClass - the Class of the ancestor componentcomponents - the Components to be registered for forwarding
drag events to the ancestor Component.public ComponentMover(Component destinationComponent, Component... components)
destinationComponent - the component drage events should be forwareded tocomponents - the Components to be registered for forwarding drag
events to the parent component to be movedpublic boolean isAutoLayout()
public void setAutoLayout(boolean autoLayout)
autoLayout - when true layout will be invoked on the parent containerpublic boolean isChangeCursor()
public void setChangeCursor(boolean changeCursor)
changeCursor - when true the cursor will be changed to the
Cursor.MOVE_CURSOR while the mouse is pressedpublic Insets getDragInsets()
public void setDragInsets(Insets dragInsets)
dragInsets - public Insets getEdgeInsets()
public void setEdgeInsets(Insets edgeInsets)
edgeInsets - public void deregisterComponent(Component... components)
components - the component the listeners are removed frompublic void registerComponent(Component... components)
components - the component the listeners are added topublic Dimension getSnapSize()
public void setSnapSize(Dimension snapSize)
public void mousePressed(MouseEvent e)
mousePressed in interface MouseListenermousePressed in class MouseAdapterpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenermouseDragged in class MouseAdapterpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenermouseReleased in class MouseAdapterCopyright © 2008–2020 Ultreia.io. All rights reserved.