java.awt.dnd.DropTargetListener Java Examples

The following examples show how to use java.awt.dnd.DropTargetListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluginManagerUI.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void postInitComponents () {
    Containers.initNotify ();
    updateTable = createTabForModel(new UpdateTableModel(units));
    availableTable = createTabForModel(new AvailableTableModel (units));
    final LocalDownloadSupport localDownloadSupport = new LocalDownloadSupport();
    final LocallyDownloadedTableModel localTM = new LocallyDownloadedTableModel(localDownloadSupport);
    localTable = createTabForModel(localTM);
    installedTable = createTabForModel(new InstalledTableModel(units));

    DropTargetListener l = new LocallDownloadDnD(localDownloadSupport, localTM, this);
    final DropTarget dt = new DropTarget(null, l);
    dt.setActive(true);
    this.setDropTarget(dt);


    final SettingsTab tab = new SettingsTab(this);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            tpTabs.add(tab, INDEX_OF_SETTINGS_TAB);
            tpTabs.setTitleAt(INDEX_OF_SETTINGS_TAB, tab.getDisplayName());
        }
    });
    setWaitingState(true);
}
 
Example #2
Source File: ProcessRendererDropTarget.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void addDropTargetListener(final DropTargetListener dtl) throws TooManyListenersException {
	if (dropTragetListenerList == null) {
		dropTragetListenerList = new EventListenerList();
	}
	dropTragetListenerList.add(DropTargetListener.class, dtl);
}
 
Example #3
Source File: XEmbedCanvasPeer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #4
Source File: ProcessRendererDropTarget.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void dropActionChanged(final DropTargetDragEvent e) {
	super.dropActionChanged(e);
	if (dropTragetListenerList != null) {
		for (DropTargetListener listener : dropTragetListenerList.getListeners(DropTargetListener.class)) {
			listener.dropActionChanged(e);
		}
	}
}
 
Example #5
Source File: ProcessRendererDropTarget.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void dragExit(final DropTargetEvent e) {
	super.dragExit(e);
	view.getModel().setImportDragged(false);
	view.getModel().fireMiscChanged();
	if (dropTragetListenerList != null) {
		Object[] listeners = dropTragetListenerList.getListenerList();
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
			if (listeners[i] == DropTargetListener.class) {
				((DropTargetListener) listeners[i + 1]).dragExit(e);
			}
		}
	}
}
 
Example #6
Source File: AutoScrollingTreeDropTarget.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
AutoScrollingTreeDropTarget(JTree aTree, DropTargetListener listener) {
	super(aTree, DnDConstants.ACTION_COPY_OR_MOVE, listener);
	this.viewport = (JViewport) SwingUtilities.getAncestorOfClass(
			JViewport.class, aTree);
	this.scrollUnits = Math.max(aTree.getRowHeight(), 16);
	this.tree = aTree;
}
 
Example #7
Source File: SunDropTargetContextPeer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #8
Source File: XEmbedCanvasPeer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #9
Source File: ProcessRendererDropTarget.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void dragOver(final DropTargetDragEvent e) {
	super.dragOver(e);
	if (dropTragetListenerList != null) {
		Object[] listeners = dropTragetListenerList.getListenerList();
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
			if (listeners[i] == DropTargetListener.class) {
				((DropTargetListener) listeners[i + 1]).dragOver(e);
			}
		}
	}
}
 
Example #10
Source File: MainPanel.java    From java-swing-tips with MIT License 5 votes vote down vote up
private MainPanel() {
  super(new BorderLayout());
  JTable table = new JTable(model);
  table.setAutoCreateRowSorter(true);

  JScrollPane scroll = new JScrollPane(table);
  scroll.setComponentPopupMenu(new TablePopupMenu());
  table.setInheritsPopupMenu(true);

  DropTargetListener dtl = new ImageDropTargetListener();
  new DropTarget(table, DnDConstants.ACTION_COPY, dtl, true);
  new DropTarget(scroll.getViewport(), DnDConstants.ACTION_COPY, dtl, true);

  TableColumn col = table.getColumnModel().getColumn(0);
  col.setMinWidth(60);
  col.setMaxWidth(60);
  col.setResizable(false);

  try {
    addImage(Paths.get(getClass().getResource("test.png").toURI()));
  } catch (URISyntaxException ex) {
    ex.printStackTrace();
    UIManager.getLookAndFeel().provideErrorFeedback(this);
  }

  add(scroll);
  setPreferredSize(new Dimension(320, 240));
}
 
Example #11
Source File: SunDropTargetContextPeer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #12
Source File: XEmbedCanvasPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #13
Source File: SunDropTargetContextPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #14
Source File: AbstractPatchedTransferHandler.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Dirty hack to get the drop target listener defined in {@link TransferHandler} by method
 * invokation.
 */
public static DropTargetListener getDropTargetListener() throws NoSuchMethodException, SecurityException,
		IllegalAccessException, IllegalArgumentException, InvocationTargetException {
	Method m;
	m = TransferHandler.class.getDeclaredMethod("getDropTargetListener");
	m.setAccessible(true); // if security settings allow this
	return (DropTargetListener) m.invoke(null); // use null if the method is static
}
 
Example #15
Source File: ProcessRendererDropTarget.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void dragEnter(final DropTargetDragEvent e) {
	super.dragEnter(e);
	if (dropTragetListenerList != null) {
		Object[] listeners = dropTragetListenerList.getListenerList();
		for (int i = listeners.length - 2; i >= 0; i -= 2) {
			if (listeners[i] == DropTargetListener.class) {
				((DropTargetListener) listeners[i + 1]).dragEnter(e);
			}
		}
	}
}
 
Example #16
Source File: XEmbedCanvasPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #17
Source File: ProcessRendererDropTarget.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
public ProcessRendererDropTarget(final ProcessRendererView view, final DropTargetListener dropTargetListener) {
	super(view, TransferHandler.COPY_OR_MOVE | TransferHandler.LINK, null);
	this.view = view;
	try {
		super.addDropTargetListener(dropTargetListener);
	} catch (TooManyListenersException tmle) {
	}
}
 
Example #18
Source File: SunDropTargetContextPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #19
Source File: XEmbedCanvasPeer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #20
Source File: XEmbedCanvasPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #21
Source File: SunDropTargetContextPeer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #22
Source File: XEmbedCanvasPeer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #23
Source File: SunDropTargetContextPeer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #24
Source File: XEmbedCanvasPeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #25
Source File: XEmbedCanvasPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #26
Source File: SunDropTargetContextPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #27
Source File: XEmbedCanvasPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}
 
Example #28
Source File: SunDropTargetContextPeer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #29
Source File: SunDropTargetContextPeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
Example #30
Source File: XEmbedCanvasPeer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void addDropTargetListener(DropTargetListener dtl)
  throws TooManyListenersException {
    // Drop target listeners registered with this target will never be
    // notified, since all drag notifications are routed to the XEmbed
    // client. To avoid confusion we prohibit listeners registration
    // by throwing TooManyListenersException as if there is a listener
    // registered with this target already.
    throw new TooManyListenersException();
}