< prev index next >

src/java.desktop/share/classes/sun/swing/JLightweightFrame.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, 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

@@ -52,10 +52,11 @@
 import javax.swing.SwingUtilities;
 
 import sun.awt.AWTAccessor;
 import sun.awt.DisplayChangedListener;
 import sun.awt.LightweightFrame;
+import sun.awt.OverrideNativeWindowHandle;
 import sun.security.action.GetPropertyAction;
 import sun.swing.SwingUtilities2.RepaintListener;
 
 /**
  * The frame serves as a lightweight container which paints its content

@@ -102,10 +103,17 @@
         SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() {
             @Override
             public void updateCursor(JLightweightFrame frame) {
                 frame.updateClientCursor();
             }
+
+            @Override
+            public void overrideNativeWindowHandle(JLightweightFrame frame, long ptr) {
+                if (frame != null) {
+                    frame.overrideNativeWindowHandle(ptr);
+                }
+            }
         });
         copyBufferEnabled = "true".equals(AccessController.
             doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
     }
 

@@ -524,10 +532,17 @@
         if (target != null) {
             content.setCursor(target.getCursor());
         }
     }
 
+    private void overrideNativeWindowHandle(long handle) {
+        final Object peer = AWTAccessor.getComponentAccessor().getPeer(this);
+        if (peer instanceof OverrideNativeWindowHandle) {
+            ((OverrideNativeWindowHandle) peer).overrideWindowHandle(handle);
+        }
+    }
+
     public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
             Class<T> abstractRecognizerClass,
             DragSource ds, Component c, int srcActions,
             DragGestureListener dgl)
     {
< prev index next >