jdk/src/share/classes/java/awt/Component.java
changeset 8985 d1dcf5ef2c42
parent 8982 19c972e3d3ee
parent 8818 f0456a8381f6
child 9050 26c2c1de1631
equal deleted inserted replaced
8984:fbedde2feaa7 8985:d1dcf5ef2c42
    57 import java.awt.dnd.DropTarget;
    57 import java.awt.dnd.DropTarget;
    58 import java.lang.reflect.InvocationTargetException;
    58 import java.lang.reflect.InvocationTargetException;
    59 import java.lang.reflect.Method;
    59 import java.lang.reflect.Method;
    60 import java.security.AccessController;
    60 import java.security.AccessController;
    61 import java.security.PrivilegedAction;
    61 import java.security.PrivilegedAction;
       
    62 import java.security.AccessControlContext;
    62 import javax.accessibility.*;
    63 import javax.accessibility.*;
    63 import java.applet.Applet;
    64 import java.applet.Applet;
    64 
    65 
    65 import sun.security.action.GetPropertyAction;
    66 import sun.security.action.GetPropertyAction;
    66 import sun.awt.AppContext;
    67 import sun.awt.AppContext;
   469      * @see #getTreeLock
   470      * @see #getTreeLock
   470      */
   471      */
   471     static final Object LOCK = new AWTTreeLock();
   472     static final Object LOCK = new AWTTreeLock();
   472     static class AWTTreeLock {}
   473     static class AWTTreeLock {}
   473 
   474 
       
   475     /*
       
   476      * The component's AccessControlContext.
       
   477      */
       
   478     private transient volatile AccessControlContext acc =
       
   479         AccessController.getContext();
       
   480 
   474     /**
   481     /**
   475      * Minimum size.
   482      * Minimum size.
   476      * (This field perhaps should have been transient).
   483      * (This field perhaps should have been transient).
   477      *
   484      *
   478      * @serial
   485      * @serial
   667      * initializing final fields.
   674      * initializing final fields.
   668      */
   675      */
   669     private transient Object objectLock = new Object();
   676     private transient Object objectLock = new Object();
   670     Object getObjectLock() {
   677     Object getObjectLock() {
   671         return objectLock;
   678         return objectLock;
       
   679     }
       
   680 
       
   681     /*
       
   682      * Returns the acc this component was constructed with.
       
   683      */
       
   684     final AccessControlContext getAccessControlContext() {
       
   685         if (acc == null) {
       
   686             throw new SecurityException("Component is missing AccessControlContext");
       
   687         }
       
   688         return acc;
   672     }
   689     }
   673 
   690 
   674     boolean isPacked = false;
   691     boolean isPacked = false;
   675 
   692 
   676     /**
   693     /**
   948                 return comp.getFont_NoClientCode();
   965                 return comp.getFont_NoClientCode();
   949             }
   966             }
   950             public void processEvent(Component comp, AWTEvent e) {
   967             public void processEvent(Component comp, AWTEvent e) {
   951                 comp.processEvent(e);
   968                 comp.processEvent(e);
   952             }
   969             }
       
   970 
       
   971             public AccessControlContext getAccessControlContext(Component comp) {
       
   972                 return comp.getAccessControlContext();
       
   973             }
   953         });
   974         });
   954     }
   975     }
   955 
   976 
   956     /**
   977     /**
   957      * Constructs a new component. Class <code>Component</code> can be
   978      * Constructs a new component. Class <code>Component</code> can be
  3871          * @param caps the capabilities of the buffers
  3892          * @param caps the capabilities of the buffers
  3872          * @exception AWTException if the capabilities supplied could not be
  3893          * @exception AWTException if the capabilities supplied could not be
  3873          * supported or met
  3894          * supported or met
  3874          * @exception ClassCastException if the component is not a canvas or
  3895          * @exception ClassCastException if the component is not a canvas or
  3875          * window.
  3896          * window.
       
  3897          * @exception IllegalStateException if the component has no peer
       
  3898          * @exception IllegalArgumentException if {@code numBuffers} is less than two,
       
  3899          * or if {@code BufferCapabilities.isPageFlipping} is not
       
  3900          * {@code true}.
       
  3901          * @see #createBuffers(int, BufferCapabilities)
  3876          */
  3902          */
  3877         protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
  3903         protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
  3878             throws AWTException
  3904             throws AWTException
  3879         {
  3905         {
  3880             if (!(Component.this instanceof Window) &&
  3906             if (!(Component.this instanceof Window) &&
  8606     private void readObject(ObjectInputStream s)
  8632     private void readObject(ObjectInputStream s)
  8607       throws ClassNotFoundException, IOException
  8633       throws ClassNotFoundException, IOException
  8608     {
  8634     {
  8609         objectLock = new Object();
  8635         objectLock = new Object();
  8610 
  8636 
       
  8637         acc = AccessController.getContext();
       
  8638 
  8611         s.defaultReadObject();
  8639         s.defaultReadObject();
  8612 
  8640 
  8613         appContext = AppContext.getAppContext();
  8641         appContext = AppContext.getAppContext();
  8614         coalescingEnabled = checkCoalescing();
  8642         coalescingEnabled = checkCoalescing();
  8615         if (componentSerializedDataVersion < 4) {
  8643         if (componentSerializedDataVersion < 4) {