Package org.jjazz.uiutilities.api
Class ListIndexTransferHandler
java.lang.Object
javax.swing.TransferHandler
org.jjazz.uiutilities.api.ListIndexTransferHandler
- All Implemented Interfaces:
Serializable
A TransferHandler to reorder items in a DefaultListModel.
This differs from a typical TransferHandler which normally transfers the data. This handler transfers the "indexes" of the items to be moved. This approach should work for any Object that is contained in the ListModel. Copied from Stackoverflow.
- 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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canImport
(TransferHandler.TransferSupport support) Any Object can be transfered (since we don't actually transfer the data)int
Items can only be moved to a different location in the model.boolean
Perform the actual data import.static void
Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getVisualRepresentation, importData, setDragImage, setDragImageOffset
-
Constructor Details
-
ListIndexTransferHandler
public ListIndexTransferHandler()
-
-
Method Details
-
importData
Perform the actual data import.- Overrides:
importData
in classTransferHandler
- Parameters:
info
-
-
getSourceActions
Items can only be moved to a different location in the model.- Overrides:
getSourceActions
in classTransferHandler
-
canImport
Any Object can be transfered (since we don't actually transfer the data)- Overrides:
canImport
in classTransferHandler
-
main
-