Package mars.venus
Class FileDrop
java.lang.Object
mars.venus.FileDrop
- All Implemented Interfaces:
DropTargetListener
,EventListener
File drop handler that registers drop listeners onto a component and changes the component's
borders when dragging files over it.
This component comes from MARS Plus, a derivation of the original MARS 4.5 created by Caleb Hoff, but the code looks similar to Robert Harder's code which is now in the public domain.
- Author:
- Robert Harder
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFileDrop
(Component component, boolean recursive, FileDrop.Listener listener) FileDrop
(Component component, Border dragBorder, boolean recursive, FileDrop.Listener listener) FileDrop
(Component component, Border dragBorder, FileDrop.Listener listener) FileDrop
(Component component, FileDrop.Listener listener) FileDrop
(PrintStream logger, Component component, boolean recursive, FileDrop.Listener listener) FileDrop
(PrintStream logger, Component component, Border dragBorder, boolean recursive, FileDrop.Listener listener) Create a new file drop handler for a particular Swing Component.FileDrop
(PrintStream logger, Component component, Border dragBorder, FileDrop.Listener listener) FileDrop
(PrintStream logger, Component component, FileDrop.Listener listener) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dragEnter
(DropTargetDragEvent event) Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for theDropTarget
registered with this listener.void
dragExit
(DropTargetEvent event) Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for theDropTarget
registered with this listener.void
dragOver
(DropTargetDragEvent event) Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for theDropTarget
registered with this listener.void
drop
(DropTargetDropEvent event) Called when the drag operation has terminated with a drop on the operable part of the drop site for theDropTarget
registered with this listener.void
Called if the user has modified the current drop gesture.
-
Constructor Details
-
FileDrop
-
FileDrop
-
FileDrop
-
FileDrop
public FileDrop(PrintStream logger, Component component, boolean recursive, FileDrop.Listener listener) -
FileDrop
-
FileDrop
public FileDrop(Component component, Border dragBorder, boolean recursive, FileDrop.Listener listener) -
FileDrop
public FileDrop(PrintStream logger, Component component, Border dragBorder, FileDrop.Listener listener) -
FileDrop
public FileDrop(PrintStream logger, Component component, Border dragBorder, boolean recursive, FileDrop.Listener listener) Create a new file drop handler for a particular Swing Component.- Parameters:
logger
- Logging stream (nullable).component
- Component to register the file drop listener to.dragBorder
- Border to change the component's border to on drag over.recursive
- Whether to register the file drop listener to the component's children.listener
- File drop listener that will be invoked when a file is dropped.
-
-
Method Details
-
dragEnter
Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for theDropTarget
registered with this listener.- Specified by:
dragEnter
in interfaceDropTargetListener
- Parameters:
event
- The event.
-
dragOver
Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for theDropTarget
registered with this listener.- Specified by:
dragOver
in interfaceDropTargetListener
- Parameters:
event
- The event.
-
drop
Called when the drag operation has terminated with a drop on the operable part of the drop site for theDropTarget
registered with this listener.- Specified by:
drop
in interfaceDropTargetListener
- Parameters:
event
- The event.
-
dragExit
Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for theDropTarget
registered with this listener.- Specified by:
dragExit
in interfaceDropTargetListener
- Parameters:
event
- The event.
-
dropActionChanged
Called if the user has modified the current drop gesture.- Specified by:
dropActionChanged
in interfaceDropTargetListener
- Parameters:
event
- The event.
-