< prev index next >
modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingDnD.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -21,11 +21,11 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package javafx.embed.swing;
+package com.sun.javafx.embed.swing;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.ArrayList;
@@ -70,11 +70,11 @@
/**
* An utility class to connect DnD mechanism of Swing and FX.
* It allows FX content to use the AWT machinery for performing DnD.
*/
-final class SwingDnD {
+final public class SwingDnD {
private final Transferable dndTransferable = new DnDTransferable();
private final DragSource dragSource;
private final DragSourceListener dragSourceListener;
@@ -88,11 +88,11 @@
// SwingDnD acts as a drag source
private EmbeddedSceneDSInterface fxDragSource;
private MouseEvent me;
- SwingDnD(final JComponent comp, final EmbeddedSceneInterface embeddedScene) {
+ public SwingDnD(final JComponent comp, final EmbeddedSceneInterface embeddedScene) {
comp.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
storeMouseEvent(me);
@@ -218,21 +218,21 @@
comp.setDropTarget(new DropTarget(comp,
DnDConstants.ACTION_COPY | DnDConstants.ACTION_MOVE | DnDConstants.ACTION_LINK, dtl));
}
- void addNotify() {
+ public void addNotify() {
dragSource.addDragSourceListener(dragSourceListener);
}
- void removeNotify() {
+ public void removeNotify() {
// RT-22049: Multi-JFrame/JFXPanel app leaks JFXPanels
// Don't forget to unregister drag source listener!
dragSource.removeDragSourceListener(dragSourceListener);
}
- HostDragStartListener getDragStartListener() {
+ public HostDragStartListener getDragStartListener() {
return (dragSource, dragAction) -> {
assert Toolkit.getToolkit().isFxUserThread();
assert dragSource != null;
// The method is called from FX Scene just before entering
@@ -309,11 +309,11 @@
} else {
e.acceptDrop(transferModeToDropAction(dropResult));
}
}
- static TransferMode dropActionToTransferMode(final int dropAction) {
+ public static TransferMode dropActionToTransferMode(final int dropAction) {
switch (dropAction) {
case DnDConstants.ACTION_COPY:
return TransferMode.COPY;
case DnDConstants.ACTION_MOVE:
return TransferMode.MOVE;
@@ -324,11 +324,11 @@
default:
throw new IllegalArgumentException();
}
}
- static int transferModeToDropAction(final TransferMode tm) {
+ public static int transferModeToDropAction(final TransferMode tm) {
switch (tm) {
case COPY:
return DnDConstants.ACTION_COPY;
case MOVE:
return DnDConstants.ACTION_MOVE;
@@ -337,11 +337,11 @@
default:
throw new IllegalArgumentException();
}
}
- static Set<TransferMode> dropActionsToTransferModes(
+ public static Set<TransferMode> dropActionsToTransferModes(
final int dropActions)
{
final Set<TransferMode> tms = EnumSet.noneOf(TransferMode.class);
if ((dropActions & DnDConstants.ACTION_COPY) != 0) {
tms.add(TransferMode.COPY);
@@ -353,11 +353,11 @@
tms.add(TransferMode.LINK);
}
return Collections.unmodifiableSet(tms);
}
- static int transferModesToDropActions(final Set<TransferMode> tms) {
+ public static int transferModesToDropActions(final Set<TransferMode> tms) {
int dropActions = DnDConstants.ACTION_NONE;
for (TransferMode tm : tms) {
dropActions |= transferModeToDropAction(tm);
}
return dropActions;
< prev index next >