Package swingtree
Class ComponentDragEventDelegate<C extends JComponent>
java.lang.Object
swingtree.AbstractDelegate<C>
swingtree.ComponentDelegate<C,MouseEvent>
swingtree.ComponentMouseEventDelegate<C>
swingtree.ComponentDragEventDelegate<C>
- Type Parameters:
C- The type ofJComponentthat thisComponentDragEventDelegateis delegating to.
public final class ComponentDragEventDelegate<C extends JComponent>
extends ComponentMouseEventDelegate<C>
A
JComponent and MouseEvent delegate providing useful context information to various Action listeners
used by UIForAnySwing.onMouseDrag(Action) like for example the ComponentMouseEventDelegate.mouseX() and
ComponentMouseEventDelegate.mouseY() of the event as well as more drag specific information like
dragEvents() and dragPositions().-
Method Summary
Modifier and TypeMethodDescriptionfloatProvides the x-axis movement delta of the mouse since the start of a continuous drag without DPI scaling.floatProvides the y-axis movement delta of the mouse since the start of a continuous drag without DPI scaling.sprouts.Tuple<MouseEvent> Provides aTuple(immutable list) of allMouseEvents of a continuous mouse drag performed on the component.sprouts.Tuple<Position> SwingTree keeps track of the most recent mouse drag events of a continuous drag.Methods inherited from class swingtree.ComponentMouseEventDelegate
clickCount, isAltDown, isCtrlDown, isLeftMouseButton, isMetaDown, isMiddleMouseButton, isRightMouseButton, isShiftDown, mousePosition, mousePositionOnScreen, mouseX, mouseXOnScreen, mouseY, mouseYOnScreenMethods inherited from class swingtree.ComponentDelegate
forComponent, forSiblinghood, forSiblinghoodOfType, forSiblings, forSiblingsOfType, getComponent, getEvent, getSiblinghood, getSiblinghoodOfType, getSiblings, getSiblingsOfTypeMethods inherited from class swingtree.AbstractDelegate
_component, _isUndefinedColor, _isUndefinedFont, _siblingsSource, animateFor, animateFor, animateFor, animateFor, animateStyleFor, animateStyleFor, find, find, find, findAll, findAllByGroup, findAllByGroup, findAllByGroup, findAllByGroup, get, getBackground, getBorder, getBounds, getCursor, getFont, getForeground, getHeight, getLocation, getMaxSize, getMinSize, getParent, getPrefSize, getSize, getTooltip, getWidth, getX, getY, isEnabled, isOpaque, isVisible, paint, paint, paint, paint, parentDelegate, setBackground, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBorder, setBounds, setBounds, setBounds, setCursor, setCursor, setEnabled, setFont, setForeground, setForegroundColor, setForegroundColor, setForegroundColor, setForegroundColor, setHeight, setLocation, setMaxHeight, setMaxSize, setMaxSize, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinSize, setMinSize, setMinWidth, setPrefHeight, setPrefSize, setPrefSize, setPrefSize, setPrefWidth, setSize, setSize, setSize, setTooltip, setVisible, setWidth, shapeOf, style
-
Method Details
-
dragEvents
Provides aTuple(immutable list) of allMouseEvents of a continuous mouse drag performed on the component. When a drag ends, the tuple is empty.- Returns:
- A tuple of all
MouseEvents of a continuous mouse drag performed on the component.
-
dragPositions
SwingTree keeps track of the most recent mouse drag events of a continuous drag. This method returns aTuple(immutable list) of all mousePositions of a continuous mouse drag performed on the component.
Note that these points are scaled to "developer pixel" instead of the actual "UI scaled component space" of the underlying Swing component.
UseUI.scale(int)to convert these points back to the actual "UI scaled component space". Also note that this method returns an unmodifiable list consisting of immutablePositionobjects instead of mutablePointobjects, to protect the client from side effects.- Returns:
- A tuple (immutable list) of all mouse
Positions of a continuous mouse drag performed on the component. The points of this list represent the mouse movement track since the start of a continuous drag.
-
deltaXSinceStart
public float deltaXSinceStart()Provides the x-axis movement delta of the mouse since the start of a continuous drag without DPI scaling. So the value is in "developer pixel" not in UI scaled component space. This means that when you need to interface with the underlying Swing API then you may want to consider upscaling it again usingUI.scale(float).- Returns:
- The x-axis movement delta of the mouse since the start of a continuous drag. This value is in "developer pixel" not in UI scaled component space.
-
deltaYSinceStart
public float deltaYSinceStart()Provides the y-axis movement delta of the mouse since the start of a continuous drag without DPI scaling. So the value is in "developer pixel" not in UI scaled component space. This means that when you need to interface with the underlying Swing API then you may want to consider upscaling it again usingUI.scale(float).- Returns:
- The y-axis movement delta of the mouse since the start of a continuous drag. This value is in "developer pixel" not in UI scaled component space.
-