< prev index next >

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

Print this page
rev 51958 : 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
Reviewed-by: alanb, dfuchs, kvn
   1 /*
   2  * Copyright (c) 1998, 2015, 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


  27 
  28 import java.awt.EventQueue;
  29 import java.awt.Window;
  30 import java.awt.SystemTray;
  31 import java.awt.TrayIcon;
  32 import java.awt.Toolkit;
  33 import java.awt.GraphicsEnvironment;
  34 import java.awt.event.InvocationEvent;
  35 import java.security.AccessController;
  36 import java.security.PrivilegedAction;
  37 import java.util.Collections;
  38 import java.util.HashMap;
  39 import java.util.IdentityHashMap;
  40 import java.util.Map;
  41 import java.util.Set;
  42 import java.util.HashSet;
  43 import java.beans.PropertyChangeSupport;
  44 import java.beans.PropertyChangeListener;
  45 import java.lang.ref.SoftReference;
  46 
  47 import jdk.internal.misc.JavaAWTAccess;
  48 import jdk.internal.misc.SharedSecrets;
  49 import sun.util.logging.PlatformLogger;
  50 import java.util.concurrent.locks.Condition;
  51 import java.util.concurrent.locks.Lock;
  52 import java.util.concurrent.locks.ReentrantLock;
  53 import java.util.concurrent.atomic.AtomicInteger;
  54 import java.util.function.Supplier;
  55 
  56 /**
  57  * The AppContext is a table referenced by ThreadGroup which stores
  58  * application service instances.  (If you are not writing an application
  59  * service, or don't know what one is, please do not use this class.)
  60  * The AppContext allows applet access to what would otherwise be
  61  * potentially dangerous services, such as the ability to peek at
  62  * EventQueues or change the look-and-feel of a Swing application.<p>
  63  *
  64  * Most application services use a singleton object to provide their
  65  * services, either as a default (such as getSystemEventQueue or
  66  * getDefaultToolkit) or as static methods with class data (System).
  67  * The AppContext works with the former method by extending the concept
  68  * of "default" to be ThreadGroup-specific.  Application services


   1 /*
   2  * Copyright (c) 1998, 2018, 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


  27 
  28 import java.awt.EventQueue;
  29 import java.awt.Window;
  30 import java.awt.SystemTray;
  31 import java.awt.TrayIcon;
  32 import java.awt.Toolkit;
  33 import java.awt.GraphicsEnvironment;
  34 import java.awt.event.InvocationEvent;
  35 import java.security.AccessController;
  36 import java.security.PrivilegedAction;
  37 import java.util.Collections;
  38 import java.util.HashMap;
  39 import java.util.IdentityHashMap;
  40 import java.util.Map;
  41 import java.util.Set;
  42 import java.util.HashSet;
  43 import java.beans.PropertyChangeSupport;
  44 import java.beans.PropertyChangeListener;
  45 import java.lang.ref.SoftReference;
  46 
  47 import jdk.internal.access.JavaAWTAccess;
  48 import jdk.internal.access.SharedSecrets;
  49 import sun.util.logging.PlatformLogger;
  50 import java.util.concurrent.locks.Condition;
  51 import java.util.concurrent.locks.Lock;
  52 import java.util.concurrent.locks.ReentrantLock;
  53 import java.util.concurrent.atomic.AtomicInteger;
  54 import java.util.function.Supplier;
  55 
  56 /**
  57  * The AppContext is a table referenced by ThreadGroup which stores
  58  * application service instances.  (If you are not writing an application
  59  * service, or don't know what one is, please do not use this class.)
  60  * The AppContext allows applet access to what would otherwise be
  61  * potentially dangerous services, such as the ability to peek at
  62  * EventQueues or change the look-and-feel of a Swing application.<p>
  63  *
  64  * Most application services use a singleton object to provide their
  65  * services, either as a default (such as getSystemEventQueue or
  66  * getDefaultToolkit) or as static methods with class data (System).
  67  * The AppContext works with the former method by extending the concept
  68  * of "default" to be ThreadGroup-specific.  Application services


< prev index next >