src/java.desktop/share/classes/sun/awt/LightweightFrame.java

Print this page

        

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

@@ -89,11 +89,11 @@
     @Override public final void toBack() {}
 
     @SuppressWarnings("deprecation")
     @Override public void addNotify() {
         synchronized (getTreeLock()) {
-            if (getPeer() == null) {
+            if (!isDisplayable()) {
                 SunToolkit stk = (SunToolkit)Toolkit.getDefaultToolkit();
                 try {
                     setPeer(stk.createLightweightFrame(this));
                 } catch (Exception e) {
                     throw new RuntimeException(e);

@@ -113,13 +113,13 @@
      * this functionality.
      *
      * @param activate if <code>true</code>, activates the frame;
      *                 otherwise, deactivates the frame
      */
-    @SuppressWarnings("deprecation")
     public void emulateActivation(boolean activate) {
-        ((FramePeer)getPeer()).emulateActivation(activate);
+        final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
+        peer.emulateActivation(activate);
     }
 
     /**
      * Delegates the focus grab action to the client (embedding) application.
      * The method is called by the AWT grab machinery.