Java Code Examples for java.awt.Component#getDropTarget()
The following examples show how to use
java.awt.Component#getDropTarget() .
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: FileOpenDropHandler.java From ghidra with Apache License 2.0 | 6 votes |
private void deinitializeComponents(Component comp) { if (comp instanceof CellRendererPane) { return; } if (comp instanceof Container) { Container c = (Container) comp; c.removeContainerListener(this); Component comps[] = c.getComponents(); for (Component element : comps) { deinitializeComponents(element); } } DropTarget dt = comp.getDropTarget(); if (dt instanceof CascadedDropTarget) { CascadedDropTarget target = (CascadedDropTarget) dt; DropTarget newTarget = target.removeDropTarget(globalDropTarget); comp.setDropTarget(newTarget); } }
Example 2
Source File: SunDropTargetContextPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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 3
Source File: SunDropTargetContextPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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 4
Source File: SunDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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 5
Source File: SunDropTargetContextPeer.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * */ protected void processExitMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; DropTargetContextAccessor acc = AWTAccessor.getDropTargetContextAccessor(); if (dt == null) { currentDT = null; currentT = null; if (currentDTC != null) { acc.reset(currentDTC); } currentDTC = null; return; } if (dt != currentDT) { if (currentDTC != null) { acc.reset(currentDTC); } currentDT = dt; currentDTC = dt.getDropTargetContext(); acc.setDropTargetContextPeer(currentDTC, this); } dtc = currentDTC; if (dt.isActive()) try { ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc)); } catch (Exception e) { e.printStackTrace(); } finally { currentA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentDA = DnDConstants.ACTION_NONE; currentDT = null; currentT = null; acc.reset(currentDTC); currentDTC = null; local = null; dragRejected = false; } }
Example 6
Source File: SunDropTargetContextPeer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processExitMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (dt == null) { currentDT = null; currentT = null; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = null; return; } if (dt != currentDT) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = dt.getDropTargetContext(); currentDTC.addNotify(this); } dtc = currentDTC; if (dt.isActive()) try { ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc)); } catch (Exception e) { e.printStackTrace(); } finally { currentA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentDA = DnDConstants.ACTION_NONE; currentDT = null; currentT = null; currentDTC.removeNotify(); currentDTC = null; local = null; dragRejected = false; } }
Example 7
Source File: SunDropTargetContextPeer.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processExitMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (dt == null) { currentDT = null; currentT = null; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = null; return; } if (dt != currentDT) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = dt.getDropTargetContext(); currentDTC.addNotify(this); } dtc = currentDTC; if (dt.isActive()) try { ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc)); } catch (Exception e) { e.printStackTrace(); } finally { currentA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentDA = DnDConstants.ACTION_NONE; currentDT = null; currentT = null; currentDTC.removeNotify(); currentDTC = null; local = null; dragRejected = false; } }
Example 8
Source File: SunDropTargetContextPeer.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * 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(); DropTargetContextAccessor acc = AWTAccessor.getDropTargetContextAccessor(); if (currentDTC != null) { // some wreckage from last time acc.reset(currentDTC); currentDTC = null; } if (c.isShowing() && dt != null && dt.isActive()) { currentDT = dt; currentDTC = currentDT.getDropTargetContext(); acc.setDropTargetContextPeer(currentDTC, 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 9
Source File: SunDropTargetContextPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processExitMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (dt == null) { currentDT = null; currentT = null; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = null; return; } if (dt != currentDT) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = dt.getDropTargetContext(); currentDTC.addNotify(this); } dtc = currentDTC; if (dt.isActive()) try { ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc)); } catch (Exception e) { e.printStackTrace(); } finally { currentA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentDA = DnDConstants.ACTION_NONE; currentDT = null; currentT = null; currentDTC.removeNotify(); currentDTC = null; local = null; dragRejected = false; } }
Example 10
Source File: SunDropTargetContextPeer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 11
Source File: SunDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 12
Source File: SunDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processExitMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (dt == null) { currentDT = null; currentT = null; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = null; return; } if (dt != currentDT) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = dt.getDropTargetContext(); currentDTC.addNotify(this); } dtc = currentDTC; if (dt.isActive()) try { ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc)); } catch (Exception e) { e.printStackTrace(); } finally { currentA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentDA = DnDConstants.ACTION_NONE; currentDT = null; currentT = null; currentDTC.removeNotify(); currentDTC = null; local = null; dragRejected = false; } }
Example 13
Source File: SunDropTargetContextPeer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processDropMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); DropTarget dt = c.getDropTarget(); dropStatus = STATUS_WAIT; // drop pending ACK dropComplete = false; if (c.isShowing() && dt != null && dt.isActive()) { DropTargetContext dtc = dt.getDropTargetContext(); currentDT = dt; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); currentA = dt.getDefaultActions(); synchronized(_globalLock) { if ((local = getJVMLocalSourceTransferable()) != null) setCurrentJVMLocalSourceTransferable(null); } dropInProcess = true; try { ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc, hots, currentDA, currentSA, local != null)); } finally { if (dropStatus == STATUS_WAIT) { rejectDrop(); } else if (dropComplete == false) { dropComplete(false); } dropInProcess = false; } } else { rejectDrop(); } }
Example 14
Source File: SunDropTargetContextPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * 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(); DropTargetContextAccessor acc = AWTAccessor.getDropTargetContextAccessor(); if (currentDTC != null) { // some wreckage from last time acc.reset(currentDTC); currentDTC = null; } if (c.isShowing() && dt != null && dt.isActive()) { currentDT = dt; currentDTC = currentDT.getDropTargetContext(); acc.setDropTargetContextPeer(currentDTC, 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 15
Source File: SunDropTargetContextPeer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processExitMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (dt == null) { currentDT = null; currentT = null; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = null; return; } if (dt != currentDT) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = dt.getDropTargetContext(); currentDTC.addNotify(this); } dtc = currentDTC; if (dt.isActive()) try { ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc)); } catch (Exception e) { e.printStackTrace(); } finally { currentA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentDA = DnDConstants.ACTION_NONE; currentDT = null; currentT = null; currentDTC.removeNotify(); currentDTC = null; local = null; dragRejected = false; } }
Example 16
Source File: SunDropTargetContextPeer.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; DropTargetContextAccessor acc = AWTAccessor.getDropTargetContextAccessor(); if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { acc.reset(currentDTC); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { acc.reset(currentDTC); } currentDTC = dtc; acc.setDropTargetContextPeer(currentDTC, this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 17
Source File: SunDropTargetContextPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); int id = event.getID(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (c.isShowing() && (dt != null) && dt.isActive()) { if (currentDT != dt) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = null; } dtc = currentDT.getDropTargetContext(); if (dtc != currentDTC) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); } currentA = currentDT.getDefaultActions(); try { DropTargetDragEvent dtde = new DropTargetDragEvent(dtc, hots, currentDA, currentSA); DropTargetListener dtl = (DropTargetListener)dt; if (operationChanged) { dtl.dropActionChanged(dtde); } else { dtl.dragOver(dtde); } if (dragRejected) { currentDA = DnDConstants.ACTION_NONE; } } catch (Exception e) { e.printStackTrace(); currentDA = DnDConstants.ACTION_NONE; } } else { currentDA = DnDConstants.ACTION_NONE; } }
Example 18
Source File: SunDropTargetContextPeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processDropMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); DropTarget dt = c.getDropTarget(); dropStatus = STATUS_WAIT; // drop pending ACK dropComplete = false; if (c.isShowing() && dt != null && dt.isActive()) { DropTargetContext dtc = dt.getDropTargetContext(); currentDT = dt; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); currentA = dt.getDefaultActions(); synchronized(_globalLock) { if ((local = getJVMLocalSourceTransferable()) != null) setCurrentJVMLocalSourceTransferable(null); } dropInProcess = true; try { ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc, hots, currentDA, currentSA, local != null)); } finally { if (dropStatus == STATUS_WAIT) { rejectDrop(); } else if (dropComplete == false) { dropComplete(false); } dropInProcess = false; } } else { rejectDrop(); } }
Example 19
Source File: SunDropTargetContextPeer.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processExitMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); DropTarget dt = c.getDropTarget(); DropTargetContext dtc = null; if (dt == null) { currentDT = null; currentT = null; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = null; return; } if (dt != currentDT) { if (currentDTC != null) { currentDTC.removeNotify(); } currentDT = dt; currentDTC = dt.getDropTargetContext(); currentDTC.addNotify(this); } dtc = currentDTC; if (dt.isActive()) try { ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc)); } catch (Exception e) { e.printStackTrace(); } finally { currentA = DnDConstants.ACTION_NONE; currentSA = DnDConstants.ACTION_NONE; currentDA = DnDConstants.ACTION_NONE; currentDT = null; currentT = null; currentDTC.removeNotify(); currentDTC = null; local = null; dragRejected = false; } }
Example 20
Source File: SunDropTargetContextPeer.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * */ protected void processDropMessage(SunDropTargetEvent event) { Component c = (Component)event.getSource(); Point hots = event.getPoint(); DropTarget dt = c.getDropTarget(); dropStatus = STATUS_WAIT; // drop pending ACK dropComplete = false; if (c.isShowing() && dt != null && dt.isActive()) { DropTargetContext dtc = dt.getDropTargetContext(); currentDT = dt; if (currentDTC != null) { currentDTC.removeNotify(); } currentDTC = dtc; currentDTC.addNotify(this); currentA = dt.getDefaultActions(); synchronized(_globalLock) { if ((local = getJVMLocalSourceTransferable()) != null) setCurrentJVMLocalSourceTransferable(null); } dropInProcess = true; try { ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc, hots, currentDA, currentSA, local != null)); } finally { if (dropStatus == STATUS_WAIT) { rejectDrop(); } else if (dropComplete == false) { dropComplete(false); } dropInProcess = false; } } else { rejectDrop(); } }