Java Code Examples for javax.swing.TransferHandler#DropLocation
The following examples show how to use
javax.swing.TransferHandler#DropLocation .
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: ExtendedJListTransferHandler.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public boolean importData(TransferSupport info) { TransferHandler.DropLocation dropLocation = info.getDropLocation(); if (!canImport(info) || !(dropLocation instanceof JList.DropLocation)) { return false; } JList.DropLocation dl = (JList.DropLocation) dropLocation; JList target = (JList) info.getComponent(); DefaultListModel listModel = (DefaultListModel) target.getModel(); int max = listModel.getSize(); int index = dl.getIndex(); index = index < 0 ? max : index; // make sure to append at the end if index > size index = Math.min(index, max); addIndex = index; try { Object[] values = (Object[]) info.getTransferable().getTransferData(localObjectFlavor); for (Object value : values) { int idx = index++; listModel.add(idx, value); target.addSelectionInterval(idx, idx); } addCount = values.length; return true; } catch (UnsupportedFlavorException | IOException e) { // should never happen, log anyway to be safe LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.tools.dnd.ExtendedJListTransferHandler.unexpected_error", e); } return false; }
Example 2
Source File: ShowToolSettingsPanel.java From jeveassets with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public boolean importData(TransferSupport info) { TransferHandler.DropLocation tdl = info.getDropLocation(); if (!canImport(info) || !(tdl instanceof JList.DropLocation)) { return false; } JList.DropLocation dl = (JList.DropLocation) tdl; JList<?> target = (JList) info.getComponent(); DefaultListModel<Object> listModel = (DefaultListModel) target.getModel(); int max = listModel.getSize(); int index = dl.getIndex(); index = index < 0 ? max : index; // If it is out of range, it is appended to the end index = Math.min(index, max); addIndex = index; try { Object[] values = (Object[]) info.getTransferable().getTransferData(localObjectFlavor); for (Object value : values) { int idx = index++; listModel.add(idx, value); target.addSelectionInterval(idx, idx); } addCount = values.length; return true; } catch (UnsupportedFlavorException | IOException ex) { LOG.error(ex.getMessage(), ex); return false; } }
Example 3
Source File: SwingAccessor.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * Calculates a custom drop location for the text component, * representing where a drop at the given point should insert data. */ TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
Example 4
Source File: SwingAccessor.java From jdk8u_jdk with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 5
Source File: SwingAccessor.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 6
Source File: SwingAccessor.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 7
Source File: SwingAccessor.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 2 votes |
/** * Calculates a custom drop location for the text component, * representing where a drop at the given point should insert data. */ TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
Example 8
Source File: SwingAccessor.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 9
Source File: SwingAccessor.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Calculates a custom drop location for the text component, * representing where a drop at the given point should insert data. */ TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
Example 10
Source File: SwingAccessor.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 11
Source File: SwingAccessor.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Calculates a custom drop location for the text component, * representing where a drop at the given point should insert data. */ TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
Example 12
Source File: SwingAccessor.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 13
Source File: SwingAccessor.java From dragonwell8_jdk with GNU General Public License v2.0 | 2 votes |
/** * Calculates a custom drop location for the text component, * representing where a drop at the given point should insert data. */ TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
Example 14
Source File: SwingAccessor.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 15
Source File: SwingAccessor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 2 votes |
/** * Calculates a custom drop location for the text component, * representing where a drop at the given point should insert data. */ TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
Example 16
Source File: SwingAccessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 17
Source File: SwingAccessor.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * Calculates a custom drop location for the text component, * representing where a drop at the given point should insert data. */ TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
Example 18
Source File: SwingAccessor.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 19
Source File: SwingAccessor.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);
Example 20
Source File: SwingAccessor.java From dragonwell8_jdk with GNU General Public License v2.0 | 2 votes |
/** * Called to set or clear the drop location during a DnD operation. */ Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, Object state, boolean forDrop);