Package noaa.coastwatch.gui
Class FileTransferHandler
java.lang.Object
javax.swing.TransferHandler
noaa.coastwatch.gui.FileTransferHandler
- All Implemented Interfaces:
Serializable
The
FileTransferHandler
class is used with the
JComponent.setTransferHandler()
method to handle one
or more java.io.File
objects during a drag and drop
operation. The user must specify a Runnable
to call
when drag and drop of file information occurs. If the drag and
drop operation is not for file information, then no action is
performed.- Since:
- 3.2.1
- Author:
- Peter Hollemans
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport
-
Field Summary
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
-
Constructor Summary
ConstructorDescriptionFileTransferHandler
(Runnable runnable) Creates a new handler that calls the specified runnable. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getFile()
Gets the latest file from a drop operation.Gets the latest list of files from a drop operation.boolean
Methods inherited from class javax.swing.TransferHandler
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getSourceActions, getVisualRepresentation, importData, setDragImage, setDragImageOffset
-
Constructor Details
-
FileTransferHandler
Creates a new handler that calls the specified runnable.- Parameters:
runnable
- the runnable object whoserun()
will be called when a drop operation occurs.
-
-
Method Details
-
getFileList
Gets the latest list of files from a drop operation.- Returns:
- the list of files, or null if no drop operation has occurred.
-
getFile
Gets the latest file from a drop operation. If a list of files is available, only the first file is returned.- Returns:
- the file, or null if no drop operation has occurred.
-
canImport
- Overrides:
canImport
in classTransferHandler
-
importData
- Overrides:
importData
in classTransferHandler
-