Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/awt/AWTAccessor.java
38827 views
/*1* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.awt;2627import sun.misc.Unsafe;2829import javax.accessibility.AccessibleContext;30import java.awt.*;31import java.awt.KeyboardFocusManager;32import java.awt.DefaultKeyboardFocusManager;33import java.awt.event.InputEvent;34import java.awt.event.InvocationEvent;35import java.awt.event.KeyEvent;36import java.awt.event.MouseEvent;37import java.awt.geom.Point2D;38import java.awt.peer.ComponentPeer;39import java.awt.peer.MenuComponentPeer;4041import java.lang.reflect.InvocationTargetException;42import java.security.AccessControlContext;4344import java.io.File;45import java.util.ResourceBundle;46import java.util.Vector;4748/**49* The AWTAccessor utility class.50* The main purpose of this class is to enable accessing51* private and package-private fields of classes from52* different classes/packages. See sun.misc.SharedSecretes53* for another example.54*/55public final class AWTAccessor {5657private static final Unsafe unsafe = Unsafe.getUnsafe();5859/*60* We don't need any objects of this class.61* It's rather a collection of static methods62* and interfaces.63*/64private AWTAccessor() {65}6667/*68* An interface of accessor for the java.awt.Component class.69*/70public interface ComponentAccessor {71/*72* Sets whether the native background erase for a component73* has been disabled via SunToolkit.disableBackgroundErase().74*/75void setBackgroundEraseDisabled(Component comp, boolean disabled);76/*77* Indicates whether the native background erase for a78* component has been disabled via79* SunToolkit.disableBackgroundErase().80*/81boolean getBackgroundEraseDisabled(Component comp);82/*83*84* Gets the bounds of this component in the form of a85* <code>Rectangle</code> object. The bounds specify this86* component's width, height, and location relative to87* its parent.88*/89Rectangle getBounds(Component comp);90/*91* Sets the shape of a lw component to cut out from hw components.92*93* See 6797587, 6776743, 6768307, and 6768332 for details94*/95void setMixingCutoutShape(Component comp, Shape shape);9697/**98* Sets GraphicsConfiguration value for the component.99*/100void setGraphicsConfiguration(Component comp, GraphicsConfiguration gc);101/*102* Requests focus to the component.103*/104boolean requestFocus(Component comp, CausedFocusEvent.Cause cause);105/*106* Determines if the component can gain focus.107*/108boolean canBeFocusOwner(Component comp);109110/**111* Returns whether the component is visible without invoking112* any client code.113*/114boolean isVisible(Component comp);115116/**117* Sets the RequestFocusController.118*/119void setRequestFocusController(RequestFocusController requestController);120121/**122* Returns the appContext of the component.123*/124AppContext getAppContext(Component comp);125126/**127* Sets the appContext of the component.128*/129void setAppContext(Component comp, AppContext appContext);130131/**132* Returns the parent of the component.133*/134Container getParent(Component comp);135136/**137* Sets the parent of the component to the specified parent.138*/139void setParent(Component comp, Container parent);140141/**142* Resizes the component to the specified width and height.143*/144void setSize(Component comp, int width, int height);145146/**147* Returns the location of the component.148*/149Point getLocation(Component comp);150151/**152* Moves the component to the new location.153*/154void setLocation(Component comp, int x, int y);155156/**157* Determines whether this component is enabled.158*/159boolean isEnabled(Component comp);160161/**162* Determines whether this component is displayable.163*/164boolean isDisplayable(Component comp);165166/**167* Gets the cursor set in the component.168*/169Cursor getCursor(Component comp);170171/**172* Returns the peer of the component.173*/174ComponentPeer getPeer(Component comp);175176/**177* Sets the peer of the component to the specified peer.178*/179void setPeer(Component comp, ComponentPeer peer);180181/**182* Determines whether this component is lightweight.183*/184boolean isLightweight(Component comp);185186/**187* Returns whether or not paint messages received from188* the operating system should be ignored.189*/190boolean getIgnoreRepaint(Component comp);191192/**193* Returns the width of the component.194*/195int getWidth(Component comp);196197/**198* Returns the height of the component.199*/200int getHeight(Component comp);201202/**203* Returns the x coordinate of the component.204*/205int getX(Component comp);206207/**208* Returns the y coordinate of the component.209*/210int getY(Component comp);211212/**213* Gets the foreground color of this component.214*/215Color getForeground(Component comp);216217/**218* Gets the background color of this component.219*/220Color getBackground(Component comp);221222/**223* Sets the background of this component to the specified color.224*/225void setBackground(Component comp, Color background);226227/**228* Gets the font of the component.229*/230Font getFont(Component comp);231232/**233* Processes events occurring on this component.234*/235void processEvent(Component comp, AWTEvent e);236237238/*239* Returns the acc this component was constructed with.240*/241AccessControlContext getAccessControlContext(Component comp);242243/**244* Revalidates the component synchronously.245*/246void revalidateSynchronously(Component comp);247248}249250/*251* An interface of accessor for the java.awt.Container class.252*/253public interface ContainerAccessor {254/**255* Validates the container unconditionally.256*/257void validateUnconditionally(Container cont);258259/**260*261* Access to the private version of findComponentAt method which has262* a controllable behavior. Setting 'ignoreEnabled' to 'false'263* bypasses disabled Components during the search.264*/265Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled);266}267268/*269* An interface of accessor for java.awt.Window class.270*/271public interface WindowAccessor {272/*273* Get opacity level of the given window.274*/275float getOpacity(Window window);276/*277* Set opacity level to the given window.278*/279void setOpacity(Window window, float opacity);280/*281* Get a shape assigned to the given window.282*/283Shape getShape(Window window);284/*285* Set a shape to the given window.286*/287void setShape(Window window, Shape shape);288/*289* Set the opaque preoperty to the given window.290*/291void setOpaque(Window window, boolean isOpaque);292/*293* Update the image of a non-opaque (translucent) window.294*/295void updateWindow(Window window);296297/** Get the size of the security warning.298*/299Dimension getSecurityWarningSize(Window w);300301/**302* Set the size of the security warning.303*/304void setSecurityWarningSize(Window w, int width, int height);305306/** Set the position of the security warning.307*/308void setSecurityWarningPosition(Window w, Point2D point,309float alignmentX, float alignmentY);310311/** Request to recalculate the new position of the security warning for312* the given window size/location as reported by the native system.313*/314Point2D calculateSecurityWarningPosition(Window window,315double x, double y, double w, double h);316317/** Sets the synchronous status of focus requests on lightweight318* components in the specified window to the specified value.319*/320void setLWRequestStatus(Window changed, boolean status);321322/**323* Indicates whether this window should receive focus on subsequently324* being shown, or being moved to the front.325*/326boolean isAutoRequestFocus(Window w);327328/**329* Indicates whether the specified window is an utility window for TrayIcon.330*/331boolean isTrayIconWindow(Window w);332333/**334* Marks the specified window as an utility window for TrayIcon.335*/336void setTrayIconWindow(Window w, boolean isTrayIconWindow);337338/**339* Return an array containing all the windows this340* window currently owns.341*/342Window[] getOwnedWindows(Window w);343}344345/**346* An accessor for the AWTEvent class.347*/348public interface AWTEventAccessor {349/**350* Marks the event as posted.351*/352void setPosted(AWTEvent ev);353354/**355* Sets the flag on this AWTEvent indicating that it was356* generated by the system.357*/358void setSystemGenerated(AWTEvent ev);359360/**361* Indicates whether this AWTEvent was generated by the system.362*/363boolean isSystemGenerated(AWTEvent ev);364365/**366* Returns the acc this event was constructed with.367*/368AccessControlContext getAccessControlContext(AWTEvent ev);369370/**371* Returns binary data associated with this event;372*/373byte[] getBData(AWTEvent ev);374375/**376* Associates binary data with this event;377*/378void setBData(AWTEvent ev, byte[] bdata);379}380381public interface InputEventAccessor {382/*383* Accessor for InputEvent.getButtonDownMasks()384*/385int[] getButtonDownMasks();386}387388/**389* An accessor for the MouseEvent class.390*/391public interface MouseEventAccessor {392/**393* Indicates whether the event is a result of a touch event.394*/395boolean isCausedByTouchEvent(MouseEvent ev);396397/**398* Sets whether the event is a result of a touch event.399*/400void setCausedByTouchEvent(MouseEvent ev, boolean causedByTouchEvent);401}402403/*404* An accessor for the java.awt.Frame class.405*/406public interface FrameAccessor {407/*408* Sets the state of this frame.409*/410void setExtendedState(Frame frame, int state);411/*412* Gets the state of this frame.413*/414int getExtendedState(Frame frame);415/*416* Gets the maximized bounds of this frame.417*/418Rectangle getMaximizedBounds(Frame frame);419}420421/**422* An interface of accessor for the java.awt.KeyboardFocusManager class.423*/424public interface KeyboardFocusManagerAccessor {425/**426* Indicates whether the native implementation should427* proceed with a pending focus request for the heavyweight.428*/429int shouldNativelyFocusHeavyweight(Component heavyweight,430Component descendant,431boolean temporary,432boolean focusedWindowChangeAllowed,433long time,434CausedFocusEvent.Cause cause);435/**436* Delivers focus for the lightweight descendant of the heavyweight437* synchronously.438*/439boolean processSynchronousLightweightTransfer(Component heavyweight,440Component descendant,441boolean temporary,442boolean focusedWindowChangeAllowed,443long time);444/**445* Removes the last focus request for the heavyweight from the queue.446*/447void removeLastFocusRequest(Component heavyweight);448449/**450* Sets the most recent focus owner in the window.451*/452void setMostRecentFocusOwner(Window window, Component component);453454/**455* Returns current KFM of the specified AppContext.456*/457KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx);458459/**460* Return the current focus cycle root461*/462Container getCurrentFocusCycleRoot();463}464465/**466* An accessor for the MenuComponent class.467*/468public interface MenuComponentAccessor {469/**470* Returns the appContext of the menu component.471*/472AppContext getAppContext(MenuComponent menuComp);473474/**475* Sets the appContext of the menu component.476*/477void setAppContext(MenuComponent menuComp, AppContext appContext);478479/**480* Returns the menu container of the menu component481*/482MenuContainer getParent(MenuComponent menuComp);483484/**485* Gets the font used for this menu component.486*/487Font getFont_NoClientCode(MenuComponent menuComp);488489/**490* Returns the peer of the menu component.491*/492<T extends MenuComponentPeer> T getPeer(MenuComponent menuComp);493}494495/**496* An accessor for the EventQueue class497*/498public interface EventQueueAccessor {499/**500* Gets the event dispatch thread.501*/502Thread getDispatchThread(EventQueue eventQueue);503504/**505* Checks if the current thread is EDT for the given EQ.506*/507public boolean isDispatchThreadImpl(EventQueue eventQueue);508509/**510* Removes any pending events for the specified source object.511*/512void removeSourceEvents(EventQueue eventQueue, Object source, boolean removeAllEvents);513514/**515* Returns whether an event is pending on any of the separate Queues.516*/517boolean noEvents(EventQueue eventQueue);518519/**520* Called from PostEventQueue.postEvent to notify that a new event521* appeared.522*/523void wakeup(EventQueue eventQueue, boolean isShutdown);524525/**526* Static in EventQueue527*/528void invokeAndWait(Object source, Runnable r)529throws InterruptedException, InvocationTargetException;530531/**532* Sets the delegate for the EventQueue used by FX/AWT single threaded mode533*/534void setFwDispatcher(EventQueue eventQueue, FwDispatcher dispatcher);535536/**537* Gets most recent event time in the EventQueue538*/539long getMostRecentEventTime(EventQueue eventQueue);540}541542/*543* An accessor for the PopupMenu class544*/545public interface PopupMenuAccessor {546/*547* Returns whether the popup menu is attached to a tray548*/549boolean isTrayIconPopup(PopupMenu popupMenu);550}551552/*553* An accessor for the FileDialog class554*/555public interface FileDialogAccessor {556/*557* Sets the files the user selects558*/559void setFiles(FileDialog fileDialog, File files[]);560561/*562* Sets the file the user selects563*/564void setFile(FileDialog fileDialog, String file);565566/*567* Sets the directory the user selects568*/569void setDirectory(FileDialog fileDialog, String directory);570571/*572* Returns whether the file dialog allows the multiple file selection.573*/574boolean isMultipleMode(FileDialog fileDialog);575}576577/*578* An accessor for the ScrollPaneAdjustable class.579*/580public interface ScrollPaneAdjustableAccessor {581/*582* Sets the value of this scrollbar to the specified value.583*/584void setTypedValue(final ScrollPaneAdjustable adj, final int v,585final int type);586}587588/**589* An accessor for the CheckboxMenuItem class590*/591public interface CheckboxMenuItemAccessor {592/**593* Returns whether menu item is checked594*/595boolean getState(CheckboxMenuItem cmi);596}597598/**599* An accessor for the Cursor class600*/601public interface CursorAccessor {602/**603* Returns pData of the Cursor class604*/605long getPData(Cursor cursor);606607/**608* Sets pData to the Cursor class609*/610void setPData(Cursor cursor, long pData);611612/**613* Return type of the Cursor class614*/615int getType(Cursor cursor);616}617618/**619* An accessor for the MenuBar class620*/621public interface MenuBarAccessor {622/**623* Returns help menu624*/625Menu getHelpMenu(MenuBar menuBar);626627/**628* Returns menus629*/630Vector getMenus(MenuBar menuBar);631}632633/**634* An accessor for the MenuItem class635*/636public interface MenuItemAccessor {637/**638* Returns whether menu item is enabled639*/640boolean isEnabled(MenuItem item);641642/**643* Gets the command name of the action event that is fired644* by this menu item.645*/646String getActionCommandImpl(MenuItem item);647648/**649* Returns true if the item and all its ancestors are650* enabled, false otherwise651*/652boolean isItemEnabled(MenuItem item);653654/**655* Returns label656*/657String getLabel(MenuItem item);658659/**660* Returns shortcut661*/662MenuShortcut getShortcut(MenuItem item);663}664665/**666* An accessor for the Menu class667*/668public interface MenuAccessor {669/**670* Returns vector of the items that are part of the Menu671*/672Vector getItems(Menu menu);673}674675/**676* An accessor for the KeyEvent class677*/678public interface KeyEventAccessor {679/**680* Sets rawCode field for KeyEvent681*/682void setRawCode(KeyEvent ev, long rawCode);683684/**685* Sets primaryLevelUnicode field for KeyEvent686*/687void setPrimaryLevelUnicode(KeyEvent ev, long primaryLevelUnicode);688689/**690* Sets extendedKeyCode field for KeyEvent691*/692void setExtendedKeyCode(KeyEvent ev, long extendedKeyCode);693694/**695* Gets original source for KeyEvent696*/697Component getOriginalSource(KeyEvent ev);698}699700/**701* An accessor for the ClientPropertyKey class702*/703public interface ClientPropertyKeyAccessor {704/**705* Retrieves JComponent_TRANSFER_HANDLER enum object706*/707Object getJComponent_TRANSFER_HANDLER();708}709710/**711* An accessor for the SystemTray class712*/713public interface SystemTrayAccessor {714/**715* Support for reporting bound property changes for Object properties.716*/717void firePropertyChange(SystemTray tray, String propertyName, Object oldValue, Object newValue);718}719720/**721* An accessor for the TrayIcon class722*/723public interface TrayIconAccessor {724void addNotify(TrayIcon trayIcon) throws AWTException;725void removeNotify(TrayIcon trayIcon);726}727728/**729* An accessor for the DefaultKeyboardFocusManager class730*/731public interface DefaultKeyboardFocusManagerAccessor {732public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e);733}734735/*736* An accessor for the SequencedEventAccessor class737*/738public interface SequencedEventAccessor {739/*740* Returns the nested event.741*/742AWTEvent getNested(AWTEvent sequencedEvent);743744/*745* Returns true if the event is an instances of SequencedEvent.746*/747boolean isSequencedEvent(AWTEvent event);748}749750/*751* An accessor for the Toolkit class752*/753public interface ToolkitAccessor {754void setPlatformResources(ResourceBundle bundle);755}756757/*758* An accessor object for the InvocationEvent class759*/760public interface InvocationEventAccessor {761void dispose(InvocationEvent event);762}763764/*765* An accessor object for the SystemColor class766*/767public interface SystemColorAccessor {768void updateSystemColors();769}770771/*772* An accessor object for the AccessibleContext class773*/774public interface AccessibleContextAccessor {775void setAppContext(AccessibleContext accessibleContext, AppContext appContext);776AppContext getAppContext(AccessibleContext accessibleContext);777}778779/*780* Accessor instances are initialized in the static initializers of781* corresponding AWT classes by using setters defined below.782*/783private static ComponentAccessor componentAccessor;784private static ContainerAccessor containerAccessor;785private static WindowAccessor windowAccessor;786private static AWTEventAccessor awtEventAccessor;787private static InputEventAccessor inputEventAccessor;788private static MouseEventAccessor mouseEventAccessor;789private static FrameAccessor frameAccessor;790private static KeyboardFocusManagerAccessor kfmAccessor;791private static MenuComponentAccessor menuComponentAccessor;792private static EventQueueAccessor eventQueueAccessor;793private static PopupMenuAccessor popupMenuAccessor;794private static FileDialogAccessor fileDialogAccessor;795private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;796private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;797private static CursorAccessor cursorAccessor;798private static MenuBarAccessor menuBarAccessor;799private static MenuItemAccessor menuItemAccessor;800private static MenuAccessor menuAccessor;801private static KeyEventAccessor keyEventAccessor;802private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;803private static SystemTrayAccessor systemTrayAccessor;804private static TrayIconAccessor trayIconAccessor;805private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;806private static SequencedEventAccessor sequencedEventAccessor;807private static ToolkitAccessor toolkitAccessor;808private static InvocationEventAccessor invocationEventAccessor;809private static SystemColorAccessor systemColorAccessor;810private static AccessibleContextAccessor accessibleContextAccessor;811812/*813* Set an accessor object for the java.awt.Component class.814*/815public static void setComponentAccessor(ComponentAccessor ca) {816componentAccessor = ca;817}818819/*820* Retrieve the accessor object for the java.awt.Component class.821*/822public static ComponentAccessor getComponentAccessor() {823if (componentAccessor == null) {824unsafe.ensureClassInitialized(Component.class);825}826827return componentAccessor;828}829830/*831* Set an accessor object for the java.awt.Container class.832*/833public static void setContainerAccessor(ContainerAccessor ca) {834containerAccessor = ca;835}836837/*838* Retrieve the accessor object for the java.awt.Container class.839*/840public static ContainerAccessor getContainerAccessor() {841if (containerAccessor == null) {842unsafe.ensureClassInitialized(Container.class);843}844845return containerAccessor;846}847848/*849* Set an accessor object for the java.awt.Window class.850*/851public static void setWindowAccessor(WindowAccessor wa) {852windowAccessor = wa;853}854855/*856* Retrieve the accessor object for the java.awt.Window class.857*/858public static WindowAccessor getWindowAccessor() {859if (windowAccessor == null) {860unsafe.ensureClassInitialized(Window.class);861}862return windowAccessor;863}864865/*866* Set an accessor object for the java.awt.AWTEvent class.867*/868public static void setAWTEventAccessor(AWTEventAccessor aea) {869awtEventAccessor = aea;870}871872/*873* Retrieve the accessor object for the java.awt.AWTEvent class.874*/875public static AWTEventAccessor getAWTEventAccessor() {876if (awtEventAccessor == null) {877unsafe.ensureClassInitialized(AWTEvent.class);878}879return awtEventAccessor;880}881882/*883* Set an accessor object for the java.awt.event.InputEvent class.884*/885public static void setInputEventAccessor(InputEventAccessor iea) {886inputEventAccessor = iea;887}888889/*890* Retrieve the accessor object for the java.awt.event.InputEvent class.891*/892public static InputEventAccessor getInputEventAccessor() {893if (inputEventAccessor == null) {894unsafe.ensureClassInitialized(InputEvent.class);895}896return inputEventAccessor;897}898899/*900* Set an accessor object for the java.awt.event.MouseEvent class.901*/902public static void setMouseEventAccessor(MouseEventAccessor mea) {903mouseEventAccessor = mea;904}905906/*907* Retrieve the accessor object for the java.awt.event.MouseEvent class.908*/909public static MouseEventAccessor getMouseEventAccessor() {910if (mouseEventAccessor == null) {911unsafe.ensureClassInitialized(MouseEvent.class);912}913return mouseEventAccessor;914}915916/*917* Set an accessor object for the java.awt.Frame class.918*/919public static void setFrameAccessor(FrameAccessor fa) {920frameAccessor = fa;921}922923/*924* Retrieve the accessor object for the java.awt.Frame class.925*/926public static FrameAccessor getFrameAccessor() {927if (frameAccessor == null) {928unsafe.ensureClassInitialized(Frame.class);929}930return frameAccessor;931}932933/*934* Set an accessor object for the java.awt.KeyboardFocusManager class.935*/936public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {937kfmAccessor = kfma;938}939940/*941* Retrieve the accessor object for the java.awt.KeyboardFocusManager class.942*/943public static KeyboardFocusManagerAccessor getKeyboardFocusManagerAccessor() {944if (kfmAccessor == null) {945unsafe.ensureClassInitialized(KeyboardFocusManager.class);946}947return kfmAccessor;948}949950/*951* Set an accessor object for the java.awt.MenuComponent class.952*/953public static void setMenuComponentAccessor(MenuComponentAccessor mca) {954menuComponentAccessor = mca;955}956957/*958* Retrieve the accessor object for the java.awt.MenuComponent class.959*/960public static MenuComponentAccessor getMenuComponentAccessor() {961if (menuComponentAccessor == null) {962unsafe.ensureClassInitialized(MenuComponent.class);963}964return menuComponentAccessor;965}966967/*968* Set an accessor object for the java.awt.EventQueue class.969*/970public static void setEventQueueAccessor(EventQueueAccessor eqa) {971eventQueueAccessor = eqa;972}973974/*975* Retrieve the accessor object for the java.awt.EventQueue class.976*/977public static EventQueueAccessor getEventQueueAccessor() {978if (eventQueueAccessor == null) {979unsafe.ensureClassInitialized(EventQueue.class);980}981return eventQueueAccessor;982}983984/*985* Set an accessor object for the java.awt.PopupMenu class.986*/987public static void setPopupMenuAccessor(PopupMenuAccessor pma) {988popupMenuAccessor = pma;989}990991/*992* Retrieve the accessor object for the java.awt.PopupMenu class.993*/994public static PopupMenuAccessor getPopupMenuAccessor() {995if (popupMenuAccessor == null) {996unsafe.ensureClassInitialized(PopupMenu.class);997}998return popupMenuAccessor;999}10001001/*1002* Set an accessor object for the java.awt.FileDialog class.1003*/1004public static void setFileDialogAccessor(FileDialogAccessor fda) {1005fileDialogAccessor = fda;1006}10071008/*1009* Retrieve the accessor object for the java.awt.FileDialog class.1010*/1011public static FileDialogAccessor getFileDialogAccessor() {1012if (fileDialogAccessor == null) {1013unsafe.ensureClassInitialized(FileDialog.class);1014}1015return fileDialogAccessor;1016}10171018/*1019* Set an accessor object for the java.awt.ScrollPaneAdjustable class.1020*/1021public static void setScrollPaneAdjustableAccessor(ScrollPaneAdjustableAccessor adj) {1022scrollPaneAdjustableAccessor = adj;1023}10241025/*1026* Retrieve the accessor object for the java.awt.ScrollPaneAdjustable1027* class.1028*/1029public static ScrollPaneAdjustableAccessor getScrollPaneAdjustableAccessor() {1030if (scrollPaneAdjustableAccessor == null) {1031unsafe.ensureClassInitialized(ScrollPaneAdjustable.class);1032}1033return scrollPaneAdjustableAccessor;1034}10351036/**1037* Set an accessor object for the java.awt.CheckboxMenuItem class.1038*/1039public static void setCheckboxMenuItemAccessor(CheckboxMenuItemAccessor cmia) {1040checkboxMenuItemAccessor = cmia;1041}10421043/**1044* Retrieve the accessor object for the java.awt.CheckboxMenuItem class.1045*/1046public static CheckboxMenuItemAccessor getCheckboxMenuItemAccessor() {1047if (checkboxMenuItemAccessor == null) {1048unsafe.ensureClassInitialized(CheckboxMenuItemAccessor.class);1049}1050return checkboxMenuItemAccessor;1051}10521053/**1054* Set an accessor object for the java.awt.Cursor class.1055*/1056public static void setCursorAccessor(CursorAccessor ca) {1057cursorAccessor = ca;1058}10591060/**1061* Retrieve the accessor object for the java.awt.Cursor class.1062*/1063public static CursorAccessor getCursorAccessor() {1064if (cursorAccessor == null) {1065unsafe.ensureClassInitialized(CursorAccessor.class);1066}1067return cursorAccessor;1068}10691070/**1071* Set an accessor object for the java.awt.MenuBar class.1072*/1073public static void setMenuBarAccessor(MenuBarAccessor mba) {1074menuBarAccessor = mba;1075}10761077/**1078* Retrieve the accessor object for the java.awt.MenuBar class.1079*/1080public static MenuBarAccessor getMenuBarAccessor() {1081if (menuBarAccessor == null) {1082unsafe.ensureClassInitialized(MenuBarAccessor.class);1083}1084return menuBarAccessor;1085}10861087/**1088* Set an accessor object for the java.awt.MenuItem class.1089*/1090public static void setMenuItemAccessor(MenuItemAccessor mia) {1091menuItemAccessor = mia;1092}10931094/**1095* Retrieve the accessor object for the java.awt.MenuItem class.1096*/1097public static MenuItemAccessor getMenuItemAccessor() {1098if (menuItemAccessor == null) {1099unsafe.ensureClassInitialized(MenuItemAccessor.class);1100}1101return menuItemAccessor;1102}11031104/**1105* Set an accessor object for the java.awt.Menu class.1106*/1107public static void setMenuAccessor(MenuAccessor ma) {1108menuAccessor = ma;1109}11101111/**1112* Retrieve the accessor object for the java.awt.Menu class.1113*/1114public static MenuAccessor getMenuAccessor() {1115if (menuAccessor == null) {1116unsafe.ensureClassInitialized(MenuAccessor.class);1117}1118return menuAccessor;1119}11201121/**1122* Set an accessor object for the java.awt.event.KeyEvent class.1123*/1124public static void setKeyEventAccessor(KeyEventAccessor kea) {1125keyEventAccessor = kea;1126}11271128/**1129* Retrieve the accessor object for the java.awt.event.KeyEvent class.1130*/1131public static KeyEventAccessor getKeyEventAccessor() {1132if (keyEventAccessor == null) {1133unsafe.ensureClassInitialized(KeyEventAccessor.class);1134}1135return keyEventAccessor;1136}11371138/**1139* Set an accessor object for the javax.swing.ClientPropertyKey class.1140*/1141public static void setClientPropertyKeyAccessor(ClientPropertyKeyAccessor cpka) {1142clientPropertyKeyAccessor = cpka;1143}11441145/**1146* Retrieve the accessor object for the javax.swing.ClientPropertyKey class.1147*/1148public static ClientPropertyKeyAccessor getClientPropertyKeyAccessor() {1149if (clientPropertyKeyAccessor == null) {1150unsafe.ensureClassInitialized(ClientPropertyKeyAccessor.class);1151}1152return clientPropertyKeyAccessor;1153}11541155/**1156* Set an accessor object for the java.awt.SystemTray class.1157*/1158public static void setSystemTrayAccessor(SystemTrayAccessor sta) {1159systemTrayAccessor = sta;1160}11611162/**1163* Retrieve the accessor object for the java.awt.SystemTray class.1164*/1165public static SystemTrayAccessor getSystemTrayAccessor() {1166if (systemTrayAccessor == null) {1167unsafe.ensureClassInitialized(SystemTrayAccessor.class);1168}1169return systemTrayAccessor;1170}11711172/**1173* Set an accessor object for the java.awt.TrayIcon class.1174*/1175public static void setTrayIconAccessor(TrayIconAccessor tia) {1176trayIconAccessor = tia;1177}11781179/**1180* Retrieve the accessor object for the java.awt.TrayIcon class.1181*/1182public static TrayIconAccessor getTrayIconAccessor() {1183if (trayIconAccessor == null) {1184unsafe.ensureClassInitialized(TrayIconAccessor.class);1185}1186return trayIconAccessor;1187}11881189/**1190* Set an accessor object for the java.awt.DefaultKeyboardFocusManager class.1191*/1192public static void setDefaultKeyboardFocusManagerAccessor(DefaultKeyboardFocusManagerAccessor dkfma) {1193defaultKeyboardFocusManagerAccessor = dkfma;1194}11951196/**1197* Retrieve the accessor object for the java.awt.DefaultKeyboardFocusManager class.1198*/1199public static DefaultKeyboardFocusManagerAccessor getDefaultKeyboardFocusManagerAccessor() {1200if (defaultKeyboardFocusManagerAccessor == null) {1201unsafe.ensureClassInitialized(DefaultKeyboardFocusManagerAccessor.class);1202}1203return defaultKeyboardFocusManagerAccessor;1204}1205/*1206* Set an accessor object for the java.awt.SequencedEvent class.1207*/1208public static void setSequencedEventAccessor(SequencedEventAccessor sea) {1209sequencedEventAccessor = sea;1210}12111212/*1213* Get the accessor object for the java.awt.SequencedEvent class.1214*/1215public static SequencedEventAccessor getSequencedEventAccessor() {1216// The class is not public. So we can't ensure it's initialized.1217// Null returned value means it's not initialized1218// (so not a single instance of the event has been created).1219return sequencedEventAccessor;1220}12211222/*1223* Set an accessor object for the java.awt.Toolkit class.1224*/1225public static void setToolkitAccessor(ToolkitAccessor ta) {1226toolkitAccessor = ta;1227}12281229/*1230* Get the accessor object for the java.awt.Toolkit class.1231*/1232public static ToolkitAccessor getToolkitAccessor() {1233if (toolkitAccessor == null) {1234unsafe.ensureClassInitialized(Toolkit.class);1235}12361237return toolkitAccessor;1238}12391240/*1241* Get the accessor object for the java.awt.event.InvocationEvent class.1242*/1243public static void setInvocationEventAccessor(InvocationEventAccessor invocationEventAccessor) {1244AWTAccessor.invocationEventAccessor = invocationEventAccessor;1245}12461247/*1248* Set the accessor object for the java.awt.event.InvocationEvent class.1249*/1250public static InvocationEventAccessor getInvocationEventAccessor() {1251return invocationEventAccessor;1252}12531254/*1255* Get the accessor object for the java.awt.SystemColor class.1256*/1257public static SystemColorAccessor getSystemColorAccessor() {1258if (systemColorAccessor == null) {1259unsafe.ensureClassInitialized(SystemColor.class);1260}12611262return systemColorAccessor;1263}12641265/*1266* Set the accessor object for the java.awt.SystemColor class.1267*/1268public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {1269AWTAccessor.systemColorAccessor = systemColorAccessor;1270}12711272/*1273* Get the accessor object for the javax.accessibility.AccessibleContext class.1274*/1275public static AccessibleContextAccessor getAccessibleContextAccessor() {1276if (accessibleContextAccessor == null) {1277unsafe.ensureClassInitialized(AccessibleContext.class);1278}1279return accessibleContextAccessor;1280}12811282/*1283* Set the accessor object for the javax.accessibility.AccessibleContext class.1284*/1285public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) {1286AWTAccessor.accessibleContextAccessor = accessor;1287}1288}128912901291