image thumbnail

Drag & Drop functionality for JAVA GUI components

version 1.0.0.0 (4.63 KB) by Maarten van der Seijs
Class for Drag & Drop functionality

925 Downloads

Updated 13 Oct 2015

View License

obj = dndcontrol(javaobj) creates a dndcontrol object for the specified Java object, such as 'javax.swing.JTextArea' or 'javax.swing.JList'. Two callback functions are available: obj.DropFileFcn and obj.DropStringFcn, that listen to drop actions of respectively system files or plain text.

The Drag & Drop control class relies on a Java class "MLDropTarget.class" that need to be visible on the Java classpath. To initialize, call the static method dndcontrol.initJava(). The Java class can be adjusted and recompiled if desired.
A demonstration is available from the static method dndcontrol.demo().

Example:
dndcontrol.initJava();
dndcontrol.demo();

Written by: Maarten van der Seijs, 2015.

Cite As

Maarten van der Seijs (2021). Drag & Drop functionality for JAVA GUI components (https://www.mathworks.com/matlabcentral/fileexchange/53511-drag-drop-functionality-for-java-gui-components), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!