< prev index next >

src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java

Print this page
rev 55657 : 8227587: Add internal privileged System.loadLibrary
Reviewed-by: rriggs
   1 /*
   2  * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 115      * aren't defined for the current platform.
 116      *
 117      * @see UIManager#setLookAndFeel
 118      */
 119     public boolean isSupportedLookAndFeel() {
 120         return true;
 121     }
 122 
 123     /**
 124      * UIManager.setLookAndFeel calls this method before the first
 125      * call (and typically the only call) to getDefaults().  Subclasses
 126      * should do any one-time setup they need here, rather than
 127      * in a static initializer, because look and feel class objects
 128      * may be loaded just to discover that isSupportedLookAndFeel()
 129      * returns false.
 130      *
 131      * @see #uninitialize
 132      * @see UIManager#setLookAndFeel
 133      */
 134     public void initialize() {
 135         java.security.AccessController.doPrivileged(new PrivilegedAction<Void>() {
 136                 public Void run() {
 137                     System.loadLibrary("osxui");
 138                     return null;
 139                 }
 140             });
 141 
 142         java.security.AccessController.doPrivileged(new PrivilegedAction<Void>(){
 143             @Override
 144             public Void run() {
 145                 JRSUIControl.initJRSUI();
 146                 return null;
 147             }
 148         });
 149 
 150         super.initialize();
 151         final ScreenPopupFactory spf = new ScreenPopupFactory();
 152         spf.setActive(true);
 153         PopupFactory.setSharedInstance(spf);
 154 
 155         KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(AquaMnemonicHandler.getInstance());
 156     }
 157 
 158     /**
 159      * UIManager.setLookAndFeel calls this method just before we're
 160      * replaced by a new default look and feel.   Subclasses may


   1 /*
   2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 115      * aren't defined for the current platform.
 116      *
 117      * @see UIManager#setLookAndFeel
 118      */
 119     public boolean isSupportedLookAndFeel() {
 120         return true;
 121     }
 122 
 123     /**
 124      * UIManager.setLookAndFeel calls this method before the first
 125      * call (and typically the only call) to getDefaults().  Subclasses
 126      * should do any one-time setup they need here, rather than
 127      * in a static initializer, because look and feel class objects
 128      * may be loaded just to discover that isSupportedLookAndFeel()
 129      * returns false.
 130      *
 131      * @see #uninitialize
 132      * @see UIManager#setLookAndFeel
 133      */
 134     public void initialize() {
 135         jdk.internal.access.SharedSecrets.getJavaLangAccess().loadLibrary("osxui");





 136 
 137         java.security.AccessController.doPrivileged(new PrivilegedAction<Void>(){
 138             @Override
 139             public Void run() {
 140                 JRSUIControl.initJRSUI();
 141                 return null;
 142             }
 143         });
 144 
 145         super.initialize();
 146         final ScreenPopupFactory spf = new ScreenPopupFactory();
 147         spf.setActive(true);
 148         PopupFactory.setSharedInstance(spf);
 149 
 150         KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(AquaMnemonicHandler.getInstance());
 151     }
 152 
 153     /**
 154      * UIManager.setLookAndFeel calls this method just before we're
 155      * replaced by a new default look and feel.   Subclasses may


< prev index next >