jdk/src/share/classes/sun/awt/AWTAccessor.java

Print this page
rev 5725 : Merge


  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
  23  * questions.
  24  */
  25 
  26 package sun.awt;
  27 
  28 import java.awt.*;
  29 import java.awt.KeyboardFocusManager;
  30 import java.awt.DefaultKeyboardFocusManager;
  31 import java.awt.event.InputEvent;
  32 import java.awt.event.KeyEvent;
  33 import java.awt.geom.Point2D;
  34 
  35 import sun.misc.Unsafe;
  36 import java.awt.peer.ComponentPeer;
  37 

  38 import java.security.AccessControlContext;
  39 
  40 import java.io.File;
  41 import java.util.Vector;
  42 
  43 /**
  44  * The AWTAccessor utility class.
  45  * The main purpose of this class is to enable accessing
  46  * private and package-private fields of classes from
  47  * different classes/packages. See sun.misc.SharedSecretes
  48  * for another example.
  49  */
  50 public final class AWTAccessor {
  51 
  52     private static final Unsafe unsafe = Unsafe.getUnsafe();
  53 
  54     /*
  55      * We don't need any objects of this class.
  56      * It's rather a collection of static methods
  57      * and interfaces.


 460         /**
 461          * Checks if the current thread is EDT for the given EQ.
 462          */
 463         public boolean isDispatchThreadImpl(EventQueue eventQueue);
 464 
 465         /**
 466          * Removes any pending events for the specified source object.
 467          */
 468         void removeSourceEvents(EventQueue eventQueue, Object source, boolean removeAllEvents);
 469 
 470         /**
 471          * Returns whether an event is pending on any of the separate Queues.
 472          */
 473         boolean noEvents(EventQueue eventQueue);
 474 
 475         /**
 476          * Called from PostEventQueue.postEvent to notify that a new event
 477          * appeared.
 478          */
 479         void wakeup(EventQueue eventQueue, boolean isShutdown);






 480     }
 481 
 482     /*
 483      * An accessor for the PopupMenu class
 484      */
 485     public interface PopupMenuAccessor {
 486         /*
 487          * Returns whether the popup menu is attached to a tray
 488          */
 489         boolean isTrayIconPopup(PopupMenu popupMenu);
 490     }
 491 
 492     /*
 493      * An accessor for the FileDialog class
 494      */
 495     public interface FileDialogAccessor {
 496         /*
 497          * Sets the files the user selects
 498          */
 499         void setFiles(FileDialog fileDialog, File files[]);




  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
  23  * questions.
  24  */
  25 
  26 package sun.awt;
  27 
  28 import java.awt.*;
  29 import java.awt.KeyboardFocusManager;
  30 import java.awt.DefaultKeyboardFocusManager;
  31 import java.awt.event.InputEvent;
  32 import java.awt.event.KeyEvent;
  33 import java.awt.geom.Point2D;
  34 
  35 import sun.misc.Unsafe;
  36 import java.awt.peer.ComponentPeer;
  37 
  38 import java.lang.reflect.InvocationTargetException;
  39 import java.security.AccessControlContext;
  40 
  41 import java.io.File;
  42 import java.util.Vector;
  43 
  44 /**
  45  * The AWTAccessor utility class.
  46  * The main purpose of this class is to enable accessing
  47  * private and package-private fields of classes from
  48  * different classes/packages. See sun.misc.SharedSecretes
  49  * for another example.
  50  */
  51 public final class AWTAccessor {
  52 
  53     private static final Unsafe unsafe = Unsafe.getUnsafe();
  54 
  55     /*
  56      * We don't need any objects of this class.
  57      * It's rather a collection of static methods
  58      * and interfaces.


 461         /**
 462          * Checks if the current thread is EDT for the given EQ.
 463          */
 464         public boolean isDispatchThreadImpl(EventQueue eventQueue);
 465 
 466         /**
 467          * Removes any pending events for the specified source object.
 468          */
 469         void removeSourceEvents(EventQueue eventQueue, Object source, boolean removeAllEvents);
 470 
 471         /**
 472          * Returns whether an event is pending on any of the separate Queues.
 473          */
 474         boolean noEvents(EventQueue eventQueue);
 475 
 476         /**
 477          * Called from PostEventQueue.postEvent to notify that a new event
 478          * appeared.
 479          */
 480         void wakeup(EventQueue eventQueue, boolean isShutdown);
 481 
 482         /**
 483          * Static in EventQueue
 484          */
 485         void invokeAndWait(Object source, Runnable r)
 486             throws InterruptedException, InvocationTargetException;
 487     }
 488 
 489     /*
 490      * An accessor for the PopupMenu class
 491      */
 492     public interface PopupMenuAccessor {
 493         /*
 494          * Returns whether the popup menu is attached to a tray
 495          */
 496         boolean isTrayIconPopup(PopupMenu popupMenu);
 497     }
 498 
 499     /*
 500      * An accessor for the FileDialog class
 501      */
 502     public interface FileDialogAccessor {
 503         /*
 504          * Sets the files the user selects
 505          */
 506         void setFiles(FileDialog fileDialog, File files[]);