src/share/classes/sun/awt/SunToolkit.java

Print this page

        

@@ -384,11 +384,11 @@
      * This can be used to determine things like which EventQueue
      * to use for posting events to a Component.  If the target is
      * null or the target can't be found, a null with be returned.
      */
     public static AppContext targetToAppContext(Object target) {
-        if (target == null || GraphicsEnvironment.isHeadless()) {
+        if (target == null) {
             return null;
         }
         AppContext context = getAppContext(target);
         if (context == null) {
             // target is not a Component/MenuComponent, try the

@@ -458,18 +458,16 @@
     /*
      * Insert a mapping from target to AppContext, for later retrieval
      * via targetToAppContext() above.
      */
     public static void insertTargetMapping(Object target, AppContext appContext) {
-        if (!GraphicsEnvironment.isHeadless()) {
             if (!setAppContext(target, appContext)) {
                 // Target is not a Component/MenuComponent, use the private Map
                 // instead.
                 appContextMap.put(target, appContext);
             }
         }
-    }
 
     /*
      * Post an AWTEvent to the Java EventQueue, using the PostEventQueue
      * to avoid possibly calling client code (EventQueueSubclass.postEvent())
      * on the toolkit (AWT-Windows/AWT-Motif) thread.  This function should