|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.TransferHandler org.xnap.commons.gui.dnd.AbstractFileTransferHandler org.xnap.commons.gui.dnd.DefaultTextFieldFileTransferHandler
public class DefaultTextFieldFileTransferHandler
Provides a default file transfer handler for JTextField
s.
When creating a transferable the text of the textfield is interpreted as the absolute path of the file.
When a file is dropped on the text field, the file's absolute path replaces the current text of the text field.
Use the static install(JTextField)
method to install it for a text
field.
Field Summary |
---|
Fields inherited from class org.xnap.commons.gui.dnd.AbstractFileTransferHandler |
---|
linuxURIFlavor |
Fields inherited from class javax.swing.TransferHandler |
---|
COPY, COPY_OR_MOVE, MOVE, NONE |
Constructor Summary | |
---|---|
protected |
DefaultTextFieldFileTransferHandler()
|
Method Summary | |
---|---|
protected Transferable |
createTransferable(JComponent c)
Returns null, if the text field is empty or disabled. |
boolean |
importFiles(JComponent comp,
List<File> files)
Overriden to set the text of the textfield to the absolute path of the first file of the list. |
static void |
install(JTextField textField)
Installs the default file transfer handler for this textField
Does not activate dragging, call
JTextComponent.setDragEnabled(boolean)
to enable it. |
Methods inherited from class org.xnap.commons.gui.dnd.AbstractFileTransferHandler |
---|
canImport, getSourceActions, importData |
Methods inherited from class javax.swing.TransferHandler |
---|
exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DefaultTextFieldFileTransferHandler()
Method Detail |
---|
public static void install(JTextField textField)
textField
Does not activate dragging, call
JTextComponent.setDragEnabled(boolean)
to enable it.
The transfer handler can be be removed by calling
textField.setTransferHandler(null)
.
textField
- protected Transferable createTransferable(JComponent c)
createTransferable
in class AbstractFileTransferHandler
public boolean importFiles(JComponent comp, List<File> files)
importFiles
in class AbstractFileTransferHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |