/** * Creates a droppable text pane. */ public DroppableTextPane() { new DropTarget(this, this); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, this); }
/** * Creates a droppable rame. */ public DroppableFrame() { new DropTarget(this, this); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, this); }
@Override public void hierarchyChanged(java.awt.event.HierarchyEvent evt) { log(out, "FileDrop: Hierarchy changed."); java.awt.Component parent = c.getParent(); if (parent == null) { c.setDropTarget(null); log(out, "FileDrop: Drop target cleared from component."); } // end if: null parent else { new java.awt.dnd.DropTarget(c, FileDrop.this.dropListener); log(out, "FileDrop: Drop target added to component."); } // end else: parent not null } // end hierarchyChanged }); // end hierarchy listener
private void dnd() { FileDropTargetListener l = new FileDropTargetListener(); l.addDndAction(new DndAction() { @Override public void onDrop(List<File> files) { loadFromFile(files.get(0)); } }); new DropTarget(jta_in, l); }
splitPane.setRightComponent(tabbedPane); new DropTarget(this, DnDConstants.ACTION_COPY, new MainDropTarget(this));
new DropTarget(jta, l); new DropTarget(jb_body, l);
new DropTarget(jtf_file, l); new DropTarget(jb_body_file, l);
new DropTarget(jtf_file, l); new DropTarget(jb_file, l);
private void makeDropTarget(final java.io.PrintStream out, final java.awt.Component c, boolean recursive) { final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget(); try { dt.addDropTargetListener(this.dropListener); new java.awt.dnd.DropTarget(c, FileDrop.this.dropListener); log(out, "FileDrop: Drop target added to component."); new java.awt.dnd.DropTarget(c, this.dropListener);
new DropTarget(jtf_file, dndListener); new DropTarget(jb_browse, dndListener);
new DropTarget(se_test_script.getEditorView(), l); new DropTarget(jb_req_test_open, l);
private JDesktopPane initDesktopPane(GCViewerGui gui, GCModelLoaderController controller) { JDesktopPane desktopPane = new DesktopPane(); desktopPane.setDropTarget(new DropTarget(gui, DnDConstants.ACTION_COPY, new FileDropTargetListener(controller, DropFlavor.OPEN))); return desktopPane; }
DropTarget dt = new DropTarget(); dt.addDropTargetListener(new DropListener(this)); this.setDropTarget(dt);
FileOpenUtil.open(view, files.get(0)); }); new DropTarget(this, l);
loadFile(files.get(0)); }); new DropTarget(jb_body_file, l); new DropTarget(se_req_body.getEditorView(), l);
private void openGCResource(GCResource gcResource, GCModelLoader loader) { GCDocument document = new GCDocument(gcViewerGui.getPreferences(), gcResource.getResourceName()); document.setDropTarget(new DropTarget(document, DnDConstants.ACTION_COPY, new FileDropTargetListener(this, DropFlavor.ADD))); document.addInternalFrameListener(new GCViewerGuiInternalFrameController()); gcViewerGui.addDocument(document); GCDocumentController docController = new GCDocumentController(document); docController.addGCResource(loader, getViewMenuController()); loader.execute(); }
/** Creates the instance, makes given component active for * drop operation. */ IndexedDropTarget(IndexedCustomizer dialog, IndexedDragSource ids) { this.dialog = dialog; this.comp = dialog.control; this.cellRenderer = (IndexedListCellRenderer) this.comp.getCellRenderer(); this.ids = ids; new DropTarget(comp, DnDConstants.ACTION_MOVE, this, true); }
/** * Constructor allowing the list model to be specified * * @param model an instance of DnDListModel * @throws IllegalArgumentException if model is null */ public DnDList(DnDListModel<T> model) { super(model); if (model == null) { throw new IllegalArgumentException("model must not be null"); } // this.setModel(model); src = new DragSource(); src.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this); tgt = new DropTarget(this, this); movingItems = false; overIndex = -1; }
setLayout(null); list = new JList(); DropTarget dropTarget = new DropTarget(list, this); list.setModel(listModel); list.setDragEnabled(true);
dropTarget = new DropTarget(this, this);