Java Code Examples for java.awt.dnd.DragSource#getDefaultDragSource()
The following examples show how to use
java.awt.dnd.DragSource#getDefaultDragSource() .
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: SourcePanel.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public SourcePanel() { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 2
Source File: MissingEventsOnModalDialogTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Frame sourceFrame = createFrame("Source Frame", 0, 0); Frame targetFrame = createFrame("Target Frame", 250, 250); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDragGestureListener()); new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDropTargetListener(targetFrame)); Robot robot = new Robot(); robot.setAutoDelay(50); sourceFrame.toFront(); robot.waitForIdle(); Point point = getCenterPoint(sourceFrame); robot.mouseMove(point.x, point.y); robot.waitForIdle(); mouseDragAndDrop(robot, point, getCenterPoint(targetFrame)); long time = System.currentTimeMillis() + 1000; while (!passed) { if (time < System.currentTimeMillis()) { sourceFrame.dispose(); targetFrame.dispose(); throw new RuntimeException("Mouse clicked event is lost!"); } Thread.sleep(10); } sourceFrame.dispose(); targetFrame.dispose(); }
Example 3
Source File: SourcePanel.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public SourcePanel () { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 4
Source File: SourcePanel.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public SourcePanel () { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 5
Source File: MissingEventsOnModalDialogTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Frame sourceFrame = createFrame("Source Frame", 0, 0); Frame targetFrame = createFrame("Target Frame", 250, 250); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDragGestureListener()); new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDropTargetListener(targetFrame)); Robot robot = new Robot(); robot.setAutoDelay(50); sourceFrame.toFront(); robot.waitForIdle(); Point point = getCenterPoint(sourceFrame); robot.mouseMove(point.x, point.y); robot.waitForIdle(); mouseDragAndDrop(robot, point, getCenterPoint(targetFrame)); long time = System.currentTimeMillis() + 200; while (!passed) { if (time < System.currentTimeMillis()) { sourceFrame.dispose(); targetFrame.dispose(); throw new RuntimeException("Mouse clicked event is lost!"); } Thread.sleep(10); } sourceFrame.dispose(); targetFrame.dispose(); }
Example 6
Source File: SourcePanel.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public SourcePanel () { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 7
Source File: MissingEventsOnModalDialogTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Frame sourceFrame = createFrame("Source Frame", 0, 0); Frame targetFrame = createFrame("Target Frame", 250, 250); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDragGestureListener()); new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDropTargetListener(targetFrame)); Robot robot = new Robot(); robot.setAutoDelay(50); sourceFrame.toFront(); robot.waitForIdle(); Point point = getCenterPoint(sourceFrame); robot.mouseMove(point.x, point.y); robot.waitForIdle(); mouseDragAndDrop(robot, point, getCenterPoint(targetFrame)); long time = System.currentTimeMillis() + 200; while (!passed) { if (time < System.currentTimeMillis()) { sourceFrame.dispose(); targetFrame.dispose(); throw new RuntimeException("Mouse clicked event is lost!"); } Thread.sleep(10); } sourceFrame.dispose(); targetFrame.dispose(); }
Example 8
Source File: SourcePanel.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public SourcePanel() { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 9
Source File: SourcePanel.java From hottub with GNU General Public License v2.0 | 5 votes |
public SourcePanel() { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 10
Source File: IndexedCustomizer.java From netbeans with Apache License 2.0 | 5 votes |
/** Creates drag source with asociated list where drag * will take place. * Also creates the default gesture and asociates this with * given component */ IndexedDragSource(JList comp) { this.comp = comp; // initialize gesture DragSource ds = DragSource.getDefaultDragSource(); ds.createDefaultDragGestureRecognizer(comp, DnDConstants.ACTION_MOVE, this); }
Example 11
Source File: SourcePanel.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public SourcePanel () { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 12
Source File: MissingEventsOnModalDialogTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Frame sourceFrame = createFrame("Source Frame", 0, 0); Frame targetFrame = createFrame("Target Frame", 250, 250); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDragGestureListener()); new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDropTargetListener(targetFrame)); Robot robot = new Robot(); robot.setAutoDelay(50); sourceFrame.toFront(); robot.waitForIdle(); Point point = getCenterPoint(sourceFrame); robot.mouseMove(point.x, point.y); robot.waitForIdle(); mouseDragAndDrop(robot, point, getCenterPoint(targetFrame)); long time = System.currentTimeMillis() + 200; while (!passed) { if (time < System.currentTimeMillis()) { sourceFrame.dispose(); targetFrame.dispose(); throw new RuntimeException("Mouse clicked event is lost!"); } Thread.sleep(10); } sourceFrame.dispose(); targetFrame.dispose(); }
Example 13
Source File: SourcePanel.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public SourcePanel () { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 14
Source File: SourcePanel.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public SourcePanel() { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 15
Source File: MissingEventsOnModalDialogTest.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Frame sourceFrame = createFrame("Source Frame", 0, 0); Frame targetFrame = createFrame("Target Frame", 250, 250); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDragGestureListener()); new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDropTargetListener(targetFrame)); Robot robot = new Robot(); robot.setAutoDelay(50); sourceFrame.toFront(); robot.waitForIdle(); Point point = getCenterPoint(sourceFrame); robot.mouseMove(point.x, point.y); robot.waitForIdle(); mouseDragAndDrop(robot, point, getCenterPoint(targetFrame)); long time = System.currentTimeMillis() + 200; while (!passed) { if (time < System.currentTimeMillis()) { sourceFrame.dispose(); targetFrame.dispose(); throw new RuntimeException("Mouse clicked event is lost!"); } Thread.sleep(10); } sourceFrame.dispose(); targetFrame.dispose(); }
Example 16
Source File: OutputTree.java From swing_library with MIT License | 5 votes |
/** * * @param treeModel * @param cPanel */ public OutputTree(OutputTreeModel treeModel) { this.setModel(treeModel); DragSource dragSource = DragSource.getDefaultDragSource(); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, this); }
Example 17
Source File: OperatorTable.java From swing_library with MIT License | 5 votes |
public OperatorTable(TableModel model) { super(model); DragSource dragSource = DragSource.getDefaultDragSource(); dragSource.createDefaultDragGestureRecognizer( this, DnDConstants.ACTION_COPY, this); }
Example 18
Source File: SourcePanel.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public SourcePanel() { setPreferredSize(new Dimension(200, 200)); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener); setBackground(Color.RED); }
Example 19
Source File: MissingEventsOnModalDialogTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Frame sourceFrame = createFrame("Source Frame", 0, 0); Frame targetFrame = createFrame("Target Frame", 250, 250); DragSource defaultDragSource = DragSource.getDefaultDragSource(); defaultDragSource.createDefaultDragGestureRecognizer(sourceFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDragGestureListener()); new DropTarget(targetFrame, DnDConstants.ACTION_COPY_OR_MOVE, new TestDropTargetListener(targetFrame)); Robot robot = new Robot(); robot.setAutoDelay(50); sourceFrame.toFront(); robot.waitForIdle(); Point point = getCenterPoint(sourceFrame); robot.mouseMove(point.x, point.y); robot.waitForIdle(); mouseDragAndDrop(robot, point, getCenterPoint(targetFrame)); long time = System.currentTimeMillis() + 200; while (!passed) { if (time < System.currentTimeMillis()) { sourceFrame.dispose(); targetFrame.dispose(); throw new RuntimeException("Mouse clicked event is lost!"); } Thread.sleep(10); } sourceFrame.dispose(); targetFrame.dispose(); }
Example 20
Source File: FileDragLabel.java From Spark with Apache License 2.0 | 4 votes |
public FileDragLabel() { DragSource dragSource = DragSource.getDefaultDragSource(); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, this); }