diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/DragRecognitionSupport.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/DragRecognitionSupport.java
index abdd460e44b..517dad35d45 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/DragRecognitionSupport.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/DragRecognitionSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, 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
@@ -29,14 +29,12 @@ import java.awt.event.*;
import java.awt.dnd.DragSource;
import javax.swing.*;
import sun.awt.dnd.SunDragSourceContextPeer;
-import sun.awt.AppContext;
/**
* Drag gesture recognition support for classes that have a
* TransferHandler. The gesture for a drag in this class is a mouse
* press followed by movement by DragSource.getDragThreshold()
- * pixels. An instance of this class is maintained per AppContext, and the
- * public static methods call into the appropriate instance.
+ * pixels.
*
* @author Shannon Hickey
*/
@@ -53,19 +51,14 @@ class DragRecognitionSupport {
public void dragStarting(MouseEvent me);
}
+ private static DragRecognitionSupport support;
/**
- * Returns the DragRecognitionSupport for the caller's AppContext.
+ * Returns the DragRecognitionSupport instance.
*/
- private static DragRecognitionSupport getDragRecognitionSupport() {
- DragRecognitionSupport support =
- (DragRecognitionSupport)AppContext.getAppContext().
- get(DragRecognitionSupport.class);
-
+ private static synchronized DragRecognitionSupport getDragRecognitionSupport() {
if (support == null) {
support = new DragRecognitionSupport();
- AppContext.getAppContext().put(DragRecognitionSupport.class, support);
}
-
return support;
}
diff --git a/src/java.desktop/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java b/src/java.desktop/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java
index 258cebd6616..4aad70961bc 100644
--- a/src/java.desktop/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java
+++ b/src/java.desktop/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2026, 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
@@ -264,8 +264,7 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
modifiers, x, y);
EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);
- SunToolkit.invokeLaterOnAppContext(
- SunToolkit.targetToAppContext(getComponent()), dispatcher);
+ SunToolkit.invokeLater(dispatcher);
startSecondaryEventLoop();
}
@@ -310,8 +309,7 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
EventDispatcher dispatcher =
new EventDispatcher(DISPATCH_EXIT, event);
- SunToolkit.invokeLaterOnAppContext(
- SunToolkit.targetToAppContext(getComponent()), dispatcher);
+ SunToolkit.invokeLater(dispatcher);
startSecondaryEventLoop();
}
@@ -341,8 +339,7 @@ public abstract class SunDragSourceContextPeer implements DragSourceContextPeer
EventDispatcher dispatcher =
new EventDispatcher(DISPATCH_FINISH, event);
- SunToolkit.invokeLaterOnAppContext(
- SunToolkit.targetToAppContext(getComponent()), dispatcher);
+ SunToolkit.invokeLater(dispatcher);
startSecondaryEventLoop();
setNativeContext(0);
diff --git a/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
index 686c3166441..70d1bda9cd0 100644
--- a/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
+++ b/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2026, 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
@@ -55,7 +55,6 @@ import sun.util.logging.PlatformLogger;
import java.io.IOException;
import java.io.InputStream;
-import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.datatransfer.DataTransferer;
import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
@@ -558,7 +557,6 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
final long nativeCtxt,
final int eventID,
final boolean dispatchType) {
- AppContext appContext = SunToolkit.targetToAppContext(component);
EventDispatcher dispatcher =
new EventDispatcher(this, dropAction, actions, formats, nativeCtxt,
@@ -572,7 +570,7 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer,
}
// schedule callback
- SunToolkit.postEvent(appContext, event);
+ SunToolkit.postEvent(event);
eventPosted(event);