Package swingtree

Class DragAwayComponentConf<C extends JComponent>

java.lang.Object
swingtree.DragAwayComponentConf<C>
Type Parameters:
C - The type of the component to be dragged away.

public final class DragAwayComponentConf<C extends JComponent> extends Object
A value based builder object for configuring drag away events of a component using the UIForAnySwing.withDragAway(Configurator) method, where an instance of this class is passed to the Configurator lambda defining how the component should behave and look when dragged away.

So you may for example use the following methods to define the visual appearance of the drag away operation:
  • enabled(boolean) - Enables or disables the drag away operation entirely.
  • opacity(double) - Sets the opacity of the drag image. The value should be between 0.0 and 1.0. A value of 0.0 means the drag image is completely transparent and a value of 1.0 means the drag image is completely opaque.
  • cursor(UI.Cursor) - Sets the cursor to be used during the drag operation. The default cursor is UI.Cursor.DEFAULT.
  • customDragImage(Image) - Sets a custom drag image to be used during the drag operation. If no custom drag image is set, the component will be rendered int a drag image during the drag operation.

For listening to drag away events, the following methods are available:
  • onDragEnter(Action) - Called as the cursor's hotspot enters a platform-dependent drop site. The provided Action is invoked when all the following conditions are true:
    • The cursor's hotspot enters the operable part of a platform- dependent drop site.
    • The drop site is active.
    • The drop site accepts the drag.
  • onDragMove(Action) - Called whenever the mouse is moved during a drag operation.
  • onDragOver(Action) - Called as the cursor's hotspot moves over a platform-dependent drop site. This method is invoked when all the following conditions are true:
    • The cursor's hotspot has moved, but still intersects the operable part of the drop site associated with the previous dragEnter() invocation.
    • The drop site is still active.
    • The drop site accepts the drag.
  • onDropActionChanged(Action) - Called when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.
  • onDragExit(Action) - Called as the cursor's hotspot exits a platform-dependent drop site. This Action is invoked when any of the following conditions are true:
    • The cursor's hotspot no longer intersects the operable part of the drop site associated with the previous dragEnter() invocation.
    OR
    • The drop site associated with the previous dragEnter() invocation is no longer active.
    OR
    • The drop site associated with the previous dragEnter() invocation has rejected the drag.
  • onDragDropEnd(Action) - This Action is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of the DragSourceDropEvent can be used to determine the termination state. The getDropAction() method