< prev index next >

src/java.desktop/share/classes/java/awt/Window.java

Print this page




  35 import java.io.IOException;
  36 import java.io.ObjectInputStream;
  37 import java.io.ObjectOutputStream;
  38 import java.io.OptionalDataException;
  39 import java.io.Serializable;
  40 import java.lang.ref.WeakReference;
  41 import java.lang.reflect.InvocationTargetException;
  42 import java.security.AccessController;
  43 import java.util.ArrayList;
  44 import java.util.Arrays;
  45 import java.util.EventListener;
  46 import java.util.Locale;
  47 import java.util.ResourceBundle;
  48 import java.util.Set;
  49 import java.util.Vector;
  50 import java.util.concurrent.atomic.AtomicBoolean;
  51 import javax.accessibility.*;
  52 import sun.awt.AWTAccessor;
  53 import sun.awt.AWTPermissions;
  54 import sun.awt.AppContext;
  55 import sun.awt.CausedFocusEvent;
  56 import sun.awt.DebugSettings;
  57 import sun.awt.SunToolkit;
  58 import sun.awt.util.IdentityArrayList;
  59 import sun.java2d.pipe.Region;
  60 import sun.security.action.GetPropertyAction;
  61 import sun.util.logging.PlatformLogger;
  62 
  63 /**
  64  * A {@code Window} object is a top-level window with no borders and no
  65  * menubar.
  66  * The default layout for a window is {@code BorderLayout}.
  67  * <p>
  68  * A window must have either a frame, dialog, or another window defined as its
  69  * owner when it's constructed.
  70  * <p>
  71  * In a multi-screen environment, you can create a {@code Window}
  72  * on a different screen device by constructing the {@code Window}
  73  * with {@link #Window(Window, GraphicsConfiguration)}.  The
  74  * {@code GraphicsConfiguration} object is one of the
  75  * {@code GraphicsConfiguration} objects of the target screen device.


 205 
 206     /**
 207      * {@code icons} is the graphical way we can
 208      * represent the frames and dialogs.
 209      * {@code Window} can't display icon but it's
 210      * being inherited by owned {@code Dialog}s.
 211      *
 212      * @serial
 213      * @see #getIconImages
 214      * @see #setIconImages
 215      */
 216     transient java.util.List<Image> icons;
 217 
 218     /**
 219      * Holds the reference to the component which last had focus in this window
 220      * before it lost focus.
 221      */
 222     private transient Component temporaryLostComponent;
 223 
 224     static boolean systemSyncLWRequests = false;
 225     boolean     syncLWRequests = false;
 226     transient boolean beforeFirstShow = true;
 227     private transient boolean disposing = false;
 228     transient WindowDisposerRecord disposerRecord = null;
 229 
 230     static final int OPENED = 0x01;
 231 
 232     /**
 233      * An Integer value representing the Window State.
 234      *
 235      * @serial
 236      * @since 1.2
 237      * @see #show
 238      */
 239     int state;
 240 
 241     /**
 242      * A boolean value representing Window always-on-top state
 243      * @since 1.5
 244      * @serial
 245      * @see #setAlwaysOnTop


4111                 changed.syncLWRequests = status;
4112             }
4113 
4114             public boolean isAutoRequestFocus(Window w) {
4115                 return w.autoRequestFocus;
4116             }
4117 
4118             public boolean isTrayIconWindow(Window w) {
4119                 return w.isTrayIconWindow;
4120             }
4121 
4122             public void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
4123                 w.isTrayIconWindow = isTrayIconWindow;
4124             }
4125         }); // WindowAccessor
4126     } // static
4127 
4128     // a window doesn't need to be updated in the Z-order.
4129     @Override
4130     void updateZOrder() {}


























4131 
4132 } // class Window
4133 
4134 
4135 /**
4136  * This class is no longer used, but is maintained for Serialization
4137  * backward-compatibility.
4138  */
4139 class FocusManager implements java.io.Serializable {
4140     Container focusRoot;
4141     Component focusOwner;
4142 
4143     /*
4144      * JDK 1.1 serialVersionUID
4145      */
4146     static final long serialVersionUID = 2491878825643557906L;
4147 }


  35 import java.io.IOException;
  36 import java.io.ObjectInputStream;
  37 import java.io.ObjectOutputStream;
  38 import java.io.OptionalDataException;
  39 import java.io.Serializable;
  40 import java.lang.ref.WeakReference;
  41 import java.lang.reflect.InvocationTargetException;
  42 import java.security.AccessController;
  43 import java.util.ArrayList;
  44 import java.util.Arrays;
  45 import java.util.EventListener;
  46 import java.util.Locale;
  47 import java.util.ResourceBundle;
  48 import java.util.Set;
  49 import java.util.Vector;
  50 import java.util.concurrent.atomic.AtomicBoolean;
  51 import javax.accessibility.*;
  52 import sun.awt.AWTAccessor;
  53 import sun.awt.AWTPermissions;
  54 import sun.awt.AppContext;

  55 import sun.awt.DebugSettings;
  56 import sun.awt.SunToolkit;
  57 import sun.awt.util.IdentityArrayList;
  58 import sun.java2d.pipe.Region;
  59 import sun.security.action.GetPropertyAction;
  60 import sun.util.logging.PlatformLogger;
  61 
  62 /**
  63  * A {@code Window} object is a top-level window with no borders and no
  64  * menubar.
  65  * The default layout for a window is {@code BorderLayout}.
  66  * <p>
  67  * A window must have either a frame, dialog, or another window defined as its
  68  * owner when it's constructed.
  69  * <p>
  70  * In a multi-screen environment, you can create a {@code Window}
  71  * on a different screen device by constructing the {@code Window}
  72  * with {@link #Window(Window, GraphicsConfiguration)}.  The
  73  * {@code GraphicsConfiguration} object is one of the
  74  * {@code GraphicsConfiguration} objects of the target screen device.


 204 
 205     /**
 206      * {@code icons} is the graphical way we can
 207      * represent the frames and dialogs.
 208      * {@code Window} can't display icon but it's
 209      * being inherited by owned {@code Dialog}s.
 210      *
 211      * @serial
 212      * @see #getIconImages
 213      * @see #setIconImages
 214      */
 215     transient java.util.List<Image> icons;
 216 
 217     /**
 218      * Holds the reference to the component which last had focus in this window
 219      * before it lost focus.
 220      */
 221     private transient Component temporaryLostComponent;
 222 
 223     static boolean systemSyncLWRequests = false;
 224     volatile boolean syncLWRequests = false;
 225     transient boolean beforeFirstShow = true;
 226     private transient boolean disposing = false;
 227     transient WindowDisposerRecord disposerRecord = null;
 228 
 229     static final int OPENED = 0x01;
 230 
 231     /**
 232      * An Integer value representing the Window State.
 233      *
 234      * @serial
 235      * @since 1.2
 236      * @see #show
 237      */
 238     int state;
 239 
 240     /**
 241      * A boolean value representing Window always-on-top state
 242      * @since 1.5
 243      * @serial
 244      * @see #setAlwaysOnTop


4110                 changed.syncLWRequests = status;
4111             }
4112 
4113             public boolean isAutoRequestFocus(Window w) {
4114                 return w.autoRequestFocus;
4115             }
4116 
4117             public boolean isTrayIconWindow(Window w) {
4118                 return w.isTrayIconWindow;
4119             }
4120 
4121             public void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
4122                 w.isTrayIconWindow = isTrayIconWindow;
4123             }
4124         }); // WindowAccessor
4125     } // static
4126 
4127     // a window doesn't need to be updated in the Z-order.
4128     @Override
4129     void updateZOrder() {}
4130 
4131     /**
4132      * Enables the synchronous focus requests on lightweight components in this window
4133      * if {@code true} is specified and the system property
4134      * {@code awt.enableSyncLWFocus} is set. Reverts to the asynchronous focus requests
4135      * if the specified value is {@code false}.
4136      * By default, all windows use asynchronous lightweight focus requests.
4137      *
4138      * The synchronous lightweight focus requests should only enabled
4139      * if this window will never transfer focus to other heavyweight containers.
4140      * In this case the observable focus behavior is the same as with
4141      * asynchronous requests.
4142      *
4143      * If the window does transfer focus to other
4144      * heavyweight containers and the synchronous lightweight focus requests
4145      * are enabled to it then further focus behavior is unspecified.
4146      *
4147      * @param    enable whether to enable the lightweight focus requests
4148      *
4149      * @see java.awt.Component#isLightweight
4150      * @since 1.9
4151      */
4152     public void setSyncLWFocus(boolean enable) {
4153         syncLWRequests = enable && java.security.AccessController.doPrivileged(
4154                 new GetPropertyAction("awt.enableSyncLWFocus")) != null;
4155     }
4156 
4157 } // class Window
4158 
4159 
4160 /**
4161  * This class is no longer used, but is maintained for Serialization
4162  * backward-compatibility.
4163  */
4164 class FocusManager implements java.io.Serializable {
4165     Container focusRoot;
4166     Component focusOwner;
4167 
4168     /*
4169      * JDK 1.1 serialVersionUID
4170      */
4171     static final long serialVersionUID = 2491878825643557906L;
4172 }
< prev index next >