Drag and Drop, Clipboard, File and Directory Choosers, Printing and WebView
Learn Drag and Drop, Clipboard, File and Directory Choosers, Printing and WebView (Phase 13 · Advanced JavaFX (Advanced), JavaFX) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Drag and drop • Source : setOnDragDetected → startDragAndDrop(TransferMode.COPY/MOVE/LINK) , put data in a ClipboardContent . Target : setOnDragOver (call acceptTransferModes if the dragboard has the expected content), setOnDragDropped (read the dragboard, setDropCompleted(true) ), setOnDragDone on the source. Works for text, files, images and custom DataFormat s; the classic use is dropping files onto the window and reordering list cells.