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

Print this page


   1 /*
   2  * Copyright (c) 2008, 2014, 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
  23  * questions.
  24  */
  25 
  26 package sun.awt;
  27 
  28 import sun.misc.Unsafe;
  29 
  30 import javax.accessibility.AccessibleContext;
  31 import java.awt.*;
  32 import java.awt.KeyboardFocusManager;
  33 import java.awt.DefaultKeyboardFocusManager;
  34 import java.awt.event.InputEvent;
  35 import java.awt.event.InvocationEvent;
  36 import java.awt.event.KeyEvent;
  37 import java.awt.geom.Point2D;
  38 import java.awt.image.BufferStrategy;
  39 import java.awt.peer.ComponentPeer;
  40 

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


 154         void setLocation(Component comp, int x, int y);
 155 
 156         /**
 157          * Determines whether this component is enabled.
 158          */
 159         boolean isEnabled(Component comp);
 160 
 161         /**
 162          * Determines whether this component is displayable.
 163          */
 164         boolean isDisplayable(Component comp);
 165 
 166         /**
 167          * Gets the cursor set in the component.
 168          */
 169         Cursor getCursor(Component comp);
 170 
 171         /**
 172          * Returns the peer of the component.
 173          */
 174         ComponentPeer getPeer(Component comp);
 175 
 176         /**
 177          * Sets the peer of the component to the specified peer.
 178          */
 179         void setPeer(Component comp, ComponentPeer peer);
 180 
 181         /**
 182          * Determines whether this component is lightweight.
 183          */
 184         boolean isLightweight(Component comp);
 185 
 186         /**
 187          * Returns whether or not paint messages received from
 188          * the operating system should be ignored.
 189          */
 190         boolean getIgnoreRepaint(Component comp);
 191 
 192         /**
 193          * Returns the width of the component.
 194          */


 464          * Return the current focus cycle root
 465          */
 466         Container getCurrentFocusCycleRoot();
 467     }
 468 
 469     /**
 470      * An accessor for the MenuComponent class.
 471      */
 472     public interface MenuComponentAccessor {
 473         /**
 474          * Returns the appContext of the menu component.
 475          */
 476         AppContext getAppContext(MenuComponent menuComp);
 477 
 478         /**
 479          * Sets the appContext of the menu component.
 480          */
 481         void setAppContext(MenuComponent menuComp, AppContext appContext);
 482 
 483         /**





 484          * Returns the menu container of the menu component.
 485          */
 486         MenuContainer getParent(MenuComponent menuComp);
 487 
 488         /**
 489          * Sets the menu container of the menu component.
 490          */
 491         void  setParent(MenuComponent menuComp, MenuContainer menuContainer);
 492 
 493         /**
 494          * Gets the font used for this menu component.
 495          */
 496         Font getFont_NoClientCode(MenuComponent menuComp);
 497     }
 498 
 499     /**
 500      * An accessor for the EventQueue class
 501      */
 502     public interface EventQueueAccessor {
 503         /**


   1 /*
   2  * Copyright (c) 2008, 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
  23  * questions.
  24  */
  25 
  26 package sun.awt;
  27 
  28 import sun.misc.Unsafe;
  29 
  30 import javax.accessibility.AccessibleContext;
  31 import java.awt.*;


  32 import java.awt.event.InputEvent;
  33 import java.awt.event.InvocationEvent;
  34 import java.awt.event.KeyEvent;
  35 import java.awt.geom.Point2D;
  36 import java.awt.image.BufferStrategy;
  37 import java.awt.peer.ComponentPeer;
  38 
  39 import java.awt.peer.MenuComponentPeer;
  40 import java.lang.reflect.InvocationTargetException;
  41 import java.security.AccessControlContext;
  42 
  43 import java.io.File;
  44 import java.util.ResourceBundle;
  45 import java.util.Vector;
  46 
  47 /**
  48  * The AWTAccessor utility class.
  49  * The main purpose of this class is to enable accessing
  50  * private and package-private fields of classes from
  51  * different classes/packages. See sun.misc.SharedSecretes
  52  * for another example.
  53  */
  54 public final class AWTAccessor {
  55 
  56     private static final Unsafe unsafe = Unsafe.getUnsafe();
  57 
  58     /*
  59      * We don't need any objects of this class.


 153         void setLocation(Component comp, int x, int y);
 154 
 155         /**
 156          * Determines whether this component is enabled.
 157          */
 158         boolean isEnabled(Component comp);
 159 
 160         /**
 161          * Determines whether this component is displayable.
 162          */
 163         boolean isDisplayable(Component comp);
 164 
 165         /**
 166          * Gets the cursor set in the component.
 167          */
 168         Cursor getCursor(Component comp);
 169 
 170         /**
 171          * Returns the peer of the component.
 172          */
 173         <T extends ComponentPeer> T getPeer(Component comp);
 174 
 175         /**
 176          * Sets the peer of the component to the specified peer.
 177          */
 178         void setPeer(Component comp, ComponentPeer peer);
 179 
 180         /**
 181          * Determines whether this component is lightweight.
 182          */
 183         boolean isLightweight(Component comp);
 184 
 185         /**
 186          * Returns whether or not paint messages received from
 187          * the operating system should be ignored.
 188          */
 189         boolean getIgnoreRepaint(Component comp);
 190 
 191         /**
 192          * Returns the width of the component.
 193          */


 463          * Return the current focus cycle root
 464          */
 465         Container getCurrentFocusCycleRoot();
 466     }
 467 
 468     /**
 469      * An accessor for the MenuComponent class.
 470      */
 471     public interface MenuComponentAccessor {
 472         /**
 473          * Returns the appContext of the menu component.
 474          */
 475         AppContext getAppContext(MenuComponent menuComp);
 476 
 477         /**
 478          * Sets the appContext of the menu component.
 479          */
 480         void setAppContext(MenuComponent menuComp, AppContext appContext);
 481 
 482         /**
 483          * Returns the peer of the menu component.
 484          */
 485         <T extends MenuComponentPeer> T getPeer(MenuComponent menuComp);
 486 
 487         /**
 488          * Returns the menu container of the menu component.
 489          */
 490         MenuContainer getParent(MenuComponent menuComp);
 491 
 492         /**
 493          * Sets the menu container of the menu component.
 494          */
 495         void  setParent(MenuComponent menuComp, MenuContainer menuContainer);
 496 
 497         /**
 498          * Gets the font used for this menu component.
 499          */
 500         Font getFont_NoClientCode(MenuComponent menuComp);
 501     }
 502 
 503     /**
 504      * An accessor for the EventQueue class
 505      */
 506     public interface EventQueueAccessor {
 507         /**