Path: blob/master/src/java.desktop/share/classes/sun/awt/AWTAccessor.java
41152 views
/*1* Copyright (c) 2008, 2021, 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 javax.accessibility.AccessibleContext;28import java.awt.*;29import java.awt.event.FocusEvent.Cause;30import java.awt.dnd.DragSourceContext;31import java.awt.dnd.DropTargetContext;32import java.awt.dnd.peer.DragSourceContextPeer;33import java.awt.dnd.peer.DropTargetContextPeer;34import java.awt.event.InputEvent;35import java.awt.event.InvocationEvent;36import java.awt.event.KeyEvent;37import java.awt.event.MouseEvent;38import java.awt.geom.Point2D;39import java.awt.image.BufferStrategy;40import java.awt.peer.ComponentPeer;4142import java.awt.peer.MenuComponentPeer;43import java.lang.invoke.MethodHandles;44import java.lang.reflect.InvocationTargetException;45import java.security.AccessControlContext;4647import java.io.File;48import java.util.ResourceBundle;49import java.util.Vector;50import javax.accessibility.AccessibleBundle;5152/**53* The AWTAccessor utility class.54* The main purpose of this class is to enable accessing55* private and package-private fields of classes from56* different classes/packages. See sun.misc.SharedSecretes57* for another example.58*/59public final class AWTAccessor {6061/*62* We don't need any objects of this class.63* It's rather a collection of static methods64* and interfaces.65*/66private AWTAccessor() {67}6869/*70* An interface of accessor for the java.awt.Component class.71*/72public interface ComponentAccessor {73/*74* Sets whether the native background erase for a component75* has been disabled via SunToolkit.disableBackgroundErase().76*/77void setBackgroundEraseDisabled(Component comp, boolean disabled);78/*79* Indicates whether the native background erase for a80* component has been disabled via81* SunToolkit.disableBackgroundErase().82*/83boolean getBackgroundEraseDisabled(Component comp);84/*85*86* Gets the bounds of this component in the form of a87* {@code Rectangle} object. The bounds specify this88* component's width, height, and location relative to89* its parent.90*/91Rectangle getBounds(Component comp);9293/**94* Sets GraphicsConfiguration value for the component.95*/96void setGraphicsConfiguration(Component comp, GraphicsConfiguration gc);97/*98* Requests focus to the component.99*/100void requestFocus(Component comp, Cause cause);101/*102* Determines if the component can gain focus.103*/104boolean canBeFocusOwner(Component comp);105106/**107* Returns whether the component is visible without invoking108* any client code.109*/110boolean isVisible(Component comp);111112/**113* Sets the RequestFocusController.114*/115void setRequestFocusController(RequestFocusController requestController);116117/**118* Returns the appContext of the component.119*/120AppContext getAppContext(Component comp);121122/**123* Sets the appContext of the component.124*/125void setAppContext(Component comp, AppContext appContext);126127/**128* Returns the parent of the component.129*/130Container getParent(Component comp);131132/**133* Sets the parent of the component to the specified parent.134*/135void setParent(Component comp, Container parent);136137/**138* Resizes the component to the specified width and height.139*/140void setSize(Component comp, int width, int height);141142/**143* Returns the location of the component.144*/145Point getLocation(Component comp);146147/**148* Moves the component to the new location.149*/150void setLocation(Component comp, int x, int y);151152/**153* Determines whether this component is enabled.154*/155boolean isEnabled(Component comp);156157/**158* Determines whether this component is displayable.159*/160boolean isDisplayable(Component comp);161162/**163* Gets the cursor set in the component.164*/165Cursor getCursor(Component comp);166167/**168* Returns the peer of the component.169*/170<T extends ComponentPeer> T getPeer(Component comp);171172/**173* Sets the peer of the component to the specified peer.174*/175void setPeer(Component comp, ComponentPeer peer);176177/**178* Determines whether this component is lightweight.179*/180boolean isLightweight(Component comp);181182/**183* Returns whether or not paint messages received from184* the operating system should be ignored.185*/186boolean getIgnoreRepaint(Component comp);187188/**189* Returns the width of the component.190*/191int getWidth(Component comp);192193/**194* Returns the height of the component.195*/196int getHeight(Component comp);197198/**199* Returns the x coordinate of the component.200*/201int getX(Component comp);202203/**204* Returns the y coordinate of the component.205*/206int getY(Component comp);207208/**209* Gets the foreground color of this component.210*/211Color getForeground(Component comp);212213/**214* Gets the background color of this component.215*/216Color getBackground(Component comp);217218/**219* Sets the background of this component to the specified color.220*/221void setBackground(Component comp, Color background);222223/**224* Gets the font of the component.225*/226Font getFont(Component comp);227228/**229* Processes events occurring on this component.230*/231void processEvent(Component comp, AWTEvent e);232233234/*235* Returns the acc this component was constructed with.236*/237@SuppressWarnings("removal")238AccessControlContext getAccessControlContext(Component comp);239240/**241* Revalidates the component synchronously.242*/243void revalidateSynchronously(Component comp);244245/**246* Creates a new strategy for multi-buffering on this component.247*/248void createBufferStrategy(Component comp, int numBuffers,249BufferCapabilities caps) throws AWTException;250251/**252* returns the buffer strategy used by this component.253*/254BufferStrategy getBufferStrategy(Component comp);255}256257/*258* An interface of accessor for the java.awt.Container class.259*/260public interface ContainerAccessor {261/**262* Validates the container unconditionally.263*/264void validateUnconditionally(Container cont);265266/**267*268* Access to the private version of findComponentAt method which has269* a controllable behavior. Setting 'ignoreEnabled' to 'false'270* bypasses disabled Components during the search.271*/272Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled);273274/**275* Starts LW Modal.276*/277void startLWModal(Container cont);278279/**280* Starts LW Modal.281*/282void stopLWModal(Container cont);283}284285/*286* An interface of accessor for java.awt.Window class.287*/288public interface WindowAccessor {289/*290* Update the image of a non-opaque (translucent) window.291*/292void updateWindow(Window window);293294/**295* Set the size of the security warning.296*/297void setSecurityWarningSize(Window w, int width, int height);298299/** Request to recalculate the new position of the security warning for300* the given window size/location as reported by the native system.301*/302Point2D calculateSecurityWarningPosition(Window window,303double x, double y, double w, double h);304305/** Sets the synchronous status of focus requests on lightweight306* components in the specified window to the specified value.307*/308void setLWRequestStatus(Window changed, boolean status);309310/**311* Indicates whether this window should receive focus on subsequently312* being shown, or being moved to the front.313*/314boolean isAutoRequestFocus(Window w);315316/**317* Indicates whether the specified window is an utility window for TrayIcon.318*/319boolean isTrayIconWindow(Window w);320321/**322* Marks the specified window as an utility window for TrayIcon.323*/324void setTrayIconWindow(Window w, boolean isTrayIconWindow);325326/**327* Return an array containing all the windows this328* window currently owns.329*/330Window[] getOwnedWindows(Window w);331}332333/**334* An accessor for the AWTEvent class.335*/336public interface AWTEventAccessor {337/**338* Marks the event as posted.339*/340void setPosted(AWTEvent ev);341342/**343* Sets the flag on this AWTEvent indicating that it was344* generated by the system.345*/346void setSystemGenerated(AWTEvent ev);347348/**349* Indicates whether this AWTEvent was generated by the system.350*/351boolean isSystemGenerated(AWTEvent ev);352353/**354* Returns the acc this event was constructed with.355*/356@SuppressWarnings("removal")357AccessControlContext getAccessControlContext(AWTEvent ev);358359/**360* Returns binary data associated with this event;361*/362byte[] getBData(AWTEvent ev);363364/**365* Associates binary data with this event;366*/367void setBData(AWTEvent ev, byte[] bdata);368}369370public interface InputEventAccessor {371/*372* Accessor for InputEvent.getButtonDownMasks()373*/374int[] getButtonDownMasks();375376/*377* Accessor for InputEvent.canAccessSystemClipboard field378*/379boolean canAccessSystemClipboard(InputEvent event);380void setCanAccessSystemClipboard(InputEvent event,381boolean canAccessSystemClipboard);382}383384/**385* An accessor for the MouseEvent class.386*/387public interface MouseEventAccessor {388/**389* Indicates whether the event is a result of a touch event.390*/391boolean isCausedByTouchEvent(MouseEvent ev);392393/**394* Sets whether the event is a result of a touch event.395*/396void setCausedByTouchEvent(MouseEvent ev, boolean causedByTouchEvent);397}398399/*400* An accessor for the java.awt.Frame class.401*/402public interface FrameAccessor {403/*404* Sets the state of this frame.405*/406void setExtendedState(Frame frame, int state);407/*408* Gets the state of this frame.409*/410int getExtendedState(Frame frame);411/*412* Gets the maximized bounds of this frame.413*/414Rectangle getMaximizedBounds(Frame frame);415}416417/**418* An interface of accessor for the java.awt.KeyboardFocusManager class.419*/420public interface KeyboardFocusManagerAccessor {421/**422* Indicates whether the native implementation should423* proceed with a pending focus request for the heavyweight.424*/425int shouldNativelyFocusHeavyweight(Component heavyweight,426Component descendant,427boolean temporary,428boolean focusedWindowChangeAllowed,429long time,430Cause cause);431/**432* Delivers focus for the lightweight descendant of the heavyweight433* synchronously.434*/435boolean processSynchronousLightweightTransfer(Component heavyweight,436Component descendant,437boolean temporary,438boolean focusedWindowChangeAllowed,439long time);440/**441* Removes the last focus request for the heavyweight from the queue.442*/443void removeLastFocusRequest(Component heavyweight);444445/**446* Gets the most recent focus owner in the window.447*/448Component getMostRecentFocusOwner(Window window);449450/**451* Sets the most recent focus owner in the window.452*/453void setMostRecentFocusOwner(Window window, Component component);454455/**456* Returns current KFM of the specified AppContext.457*/458KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx);459460/**461* Return the current focus cycle root462*/463Container getCurrentFocusCycleRoot();464}465466/**467* An accessor for the MenuComponent class.468*/469public interface MenuComponentAccessor {470/**471* Returns the appContext of the menu component.472*/473AppContext getAppContext(MenuComponent menuComp);474475/**476* Sets the appContext of the menu component.477*/478void setAppContext(MenuComponent menuComp, AppContext appContext);479480/**481* Returns the peer of the menu component.482*/483<T extends MenuComponentPeer> T getPeer(MenuComponent menuComp);484485/**486* Returns the menu container of the menu component.487*/488MenuContainer getParent(MenuComponent menuComp);489490/**491* Sets the menu container of the menu component.492*/493void setParent(MenuComponent menuComp, MenuContainer menuContainer);494495/**496* Gets the font used for this menu component.497*/498Font getFont_NoClientCode(MenuComponent menuComp);499}500501/**502* An accessor for the EventQueue class503*/504public interface EventQueueAccessor {505/**506* Gets the event dispatch thread.507*/508Thread getDispatchThread(EventQueue eventQueue);509510/**511* Checks if the current thread is EDT for the given EQ.512*/513public boolean isDispatchThreadImpl(EventQueue eventQueue);514515/**516* Removes any pending events for the specified source object.517*/518void removeSourceEvents(EventQueue eventQueue, Object source, boolean removeAllEvents);519520/**521* Returns whether an event is pending on any of the separate Queues.522*/523boolean noEvents(EventQueue eventQueue);524525/**526* Called from PostEventQueue.postEvent to notify that a new event527* appeared.528*/529void wakeup(EventQueue eventQueue, boolean isShutdown);530531/**532* Static in EventQueue533*/534void invokeAndWait(Object source, Runnable r)535throws InterruptedException, InvocationTargetException;536537/**538* Sets the delegate for the EventQueue used by FX/AWT single threaded mode539*/540void setFwDispatcher(EventQueue eventQueue, FwDispatcher dispatcher);541542/**543* Gets most recent event time in the EventQueue544*/545long getMostRecentEventTime(EventQueue eventQueue);546}547548/*549* An accessor for the PopupMenu class550*/551public interface PopupMenuAccessor {552/*553* Returns whether the popup menu is attached to a tray554*/555boolean isTrayIconPopup(PopupMenu popupMenu);556}557558/*559* An accessor for the FileDialog class560*/561public interface FileDialogAccessor {562/*563* Sets the files the user selects564*/565void setFiles(FileDialog fileDialog, File[] files);566567/*568* Sets the file the user selects569*/570void setFile(FileDialog fileDialog, String file);571572/*573* Sets the directory the user selects574*/575void setDirectory(FileDialog fileDialog, String directory);576577/*578* Returns whether the file dialog allows the multiple file selection.579*/580boolean isMultipleMode(FileDialog fileDialog);581}582583/*584* An accessor for the ScrollPaneAdjustable class.585*/586public interface ScrollPaneAdjustableAccessor {587/*588* Sets the value of this scrollbar to the specified value.589*/590void setTypedValue(final ScrollPaneAdjustable adj, final int v,591final int type);592}593594/**595* An accessor for the CheckboxMenuItem class596*/597public interface CheckboxMenuItemAccessor {598/**599* Returns whether menu item is checked600*/601boolean getState(CheckboxMenuItem cmi);602}603604/**605* An accessor for the Cursor class606*/607public interface CursorAccessor {608/**609* Returns pData of the Cursor class610*/611long getPData(Cursor cursor);612613/**614* Sets pData to the Cursor class615*/616void setPData(Cursor cursor, long pData);617618/**619* Return type of the Cursor class620*/621int getType(Cursor cursor);622}623624/**625* An accessor for the MenuBar class626*/627public interface MenuBarAccessor {628/**629* Returns help menu630*/631Menu getHelpMenu(MenuBar menuBar);632633/**634* Returns menus635*/636Vector<Menu> getMenus(MenuBar menuBar);637}638639/**640* An accessor for the MenuItem class641*/642public interface MenuItemAccessor {643/**644* Returns whether menu item is enabled645*/646boolean isEnabled(MenuItem item);647648/**649* Gets the command name of the action event that is fired650* by this menu item.651*/652String getActionCommandImpl(MenuItem item);653654/**655* Returns true if the item and all its ancestors are656* enabled, false otherwise657*/658boolean isItemEnabled(MenuItem item);659660/**661* Returns label662*/663String getLabel(MenuItem item);664665/**666* Returns shortcut667*/668MenuShortcut getShortcut(MenuItem item);669}670671/**672* An accessor for the Menu class673*/674public interface MenuAccessor {675/**676* Returns vector of the items that are part of the Menu677*/678Vector<MenuItem> getItems(Menu menu);679}680681/**682* An accessor for the KeyEvent class683*/684public interface KeyEventAccessor {685/**686* Sets rawCode field for KeyEvent687*/688void setRawCode(KeyEvent ev, long rawCode);689690/**691* Sets primaryLevelUnicode field for KeyEvent692*/693void setPrimaryLevelUnicode(KeyEvent ev, long primaryLevelUnicode);694695/**696* Sets extendedKeyCode field for KeyEvent697*/698void setExtendedKeyCode(KeyEvent ev, long extendedKeyCode);699700/**701* Gets original source for KeyEvent702*/703Component getOriginalSource(KeyEvent ev);704705/**706* Gets isProxyActive field for KeyEvent707*/708boolean isProxyActive(KeyEvent ev);709}710711/**712* An accessor for the ClientPropertyKey class713*/714public interface ClientPropertyKeyAccessor {715/**716* Retrieves JComponent_TRANSFER_HANDLER enum object717*/718Object getJComponent_TRANSFER_HANDLER();719}720721/**722* An accessor for the SystemTray class723*/724public interface SystemTrayAccessor {725/**726* Support for reporting bound property changes for Object properties.727*/728void firePropertyChange(SystemTray tray, String propertyName, Object oldValue, Object newValue);729}730731/**732* An accessor for the TrayIcon class733*/734public interface TrayIconAccessor {735void addNotify(TrayIcon trayIcon) throws AWTException;736void removeNotify(TrayIcon trayIcon);737}738739/**740* An accessor for the DefaultKeyboardFocusManager class741*/742public interface DefaultKeyboardFocusManagerAccessor {743public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e);744}745746/*747* An accessor for the SequencedEventAccessor class748*/749public interface SequencedEventAccessor {750/*751* Returns the nested event.752*/753AWTEvent getNested(AWTEvent sequencedEvent);754755/*756* Returns true if the event is an instances of SequencedEvent.757*/758boolean isSequencedEvent(AWTEvent event);759760/*761* Creates SequencedEvent with the given nested event762*/763AWTEvent create(AWTEvent event);764}765766/*767* An accessor for the Toolkit class768*/769public interface ToolkitAccessor {770void setPlatformResources(ResourceBundle bundle);771}772773/*774* An accessor object for the InvocationEvent class775*/776public interface InvocationEventAccessor {777void dispose(InvocationEvent event);778}779780/*781* An accessor object for the SystemColor class782*/783public interface SystemColorAccessor {784void updateSystemColors();785}786787/*788* An accessor object for the AccessibleContext class789*/790public interface AccessibleContextAccessor {791void setAppContext(AccessibleContext accessibleContext, AppContext appContext);792AppContext getAppContext(AccessibleContext accessibleContext);793Object getNativeAXResource(AccessibleContext accessibleContext);794void setNativeAXResource(AccessibleContext accessibleContext, Object value);795}796797/*798* An accessor object for the AccessibleContext class799*/800public interface AccessibleBundleAccessor {801String getKey(AccessibleBundle accessibleBundle);802}803804/*805* An accessor object for the DragSourceContext class806*/807public interface DragSourceContextAccessor {808/**809* Returns the peer of the DragSourceContext.810*/811DragSourceContextPeer getPeer(DragSourceContext dsc);812}813814/*815* An accessor object for the DropTargetContext class816*/817public interface DropTargetContextAccessor {818/**819* Resets the DropTargetContext.820*/821void reset(DropTargetContext dtc);822/**823* Sets the {@code DropTargetContextPeer}824*/825void setDropTargetContextPeer(DropTargetContext dtc,826DropTargetContextPeer dtcp);827}828829/*830* Accessor instances are initialized in the static initializers of831* corresponding AWT classes by using setters defined below.832*/833private static ComponentAccessor componentAccessor;834private static ContainerAccessor containerAccessor;835private static WindowAccessor windowAccessor;836private static AWTEventAccessor awtEventAccessor;837private static InputEventAccessor inputEventAccessor;838private static MouseEventAccessor mouseEventAccessor;839private static FrameAccessor frameAccessor;840private static KeyboardFocusManagerAccessor kfmAccessor;841private static MenuComponentAccessor menuComponentAccessor;842private static EventQueueAccessor eventQueueAccessor;843private static PopupMenuAccessor popupMenuAccessor;844private static FileDialogAccessor fileDialogAccessor;845private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;846private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;847private static CursorAccessor cursorAccessor;848private static MenuBarAccessor menuBarAccessor;849private static MenuItemAccessor menuItemAccessor;850private static MenuAccessor menuAccessor;851private static KeyEventAccessor keyEventAccessor;852private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;853private static SystemTrayAccessor systemTrayAccessor;854private static TrayIconAccessor trayIconAccessor;855private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;856private static SequencedEventAccessor sequencedEventAccessor;857private static ToolkitAccessor toolkitAccessor;858private static InvocationEventAccessor invocationEventAccessor;859private static SystemColorAccessor systemColorAccessor;860private static AccessibleContextAccessor accessibleContextAccessor;861private static AccessibleBundleAccessor accessibleBundleAccessor;862private static DragSourceContextAccessor dragSourceContextAccessor;863private static DropTargetContextAccessor dropTargetContextAccessor;864865/*866* Set an accessor object for the java.awt.Component class.867*/868public static void setComponentAccessor(ComponentAccessor ca) {869componentAccessor = ca;870}871872/*873* Retrieve the accessor object for the java.awt.Component class.874*/875public static ComponentAccessor getComponentAccessor() {876if (componentAccessor == null) {877ensureClassInitialized(Component.class);878}879880return componentAccessor;881}882883/*884* Set an accessor object for the java.awt.Container class.885*/886public static void setContainerAccessor(ContainerAccessor ca) {887containerAccessor = ca;888}889890/*891* Retrieve the accessor object for the java.awt.Container class.892*/893public static ContainerAccessor getContainerAccessor() {894if (containerAccessor == null) {895ensureClassInitialized(Container.class);896}897898return containerAccessor;899}900901/*902* Set an accessor object for the java.awt.Window class.903*/904public static void setWindowAccessor(WindowAccessor wa) {905windowAccessor = wa;906}907908/*909* Retrieve the accessor object for the java.awt.Window class.910*/911public static WindowAccessor getWindowAccessor() {912if (windowAccessor == null) {913ensureClassInitialized(Window.class);914}915return windowAccessor;916}917918/*919* Set an accessor object for the java.awt.AWTEvent class.920*/921public static void setAWTEventAccessor(AWTEventAccessor aea) {922awtEventAccessor = aea;923}924925/*926* Retrieve the accessor object for the java.awt.AWTEvent class.927*/928public static AWTEventAccessor getAWTEventAccessor() {929if (awtEventAccessor == null) {930ensureClassInitialized(AWTEvent.class);931}932return awtEventAccessor;933}934935/*936* Set an accessor object for the java.awt.event.InputEvent class.937*/938public static void setInputEventAccessor(InputEventAccessor iea) {939inputEventAccessor = iea;940}941942/*943* Retrieve the accessor object for the java.awt.event.InputEvent class.944*/945public static InputEventAccessor getInputEventAccessor() {946if (inputEventAccessor == null) {947ensureClassInitialized(InputEvent.class);948}949return inputEventAccessor;950}951952/*953* Set an accessor object for the java.awt.event.MouseEvent class.954*/955public static void setMouseEventAccessor(MouseEventAccessor mea) {956mouseEventAccessor = mea;957}958959/*960* Retrieve the accessor object for the java.awt.event.MouseEvent class.961*/962public static MouseEventAccessor getMouseEventAccessor() {963if (mouseEventAccessor == null) {964ensureClassInitialized(MouseEvent.class);965}966return mouseEventAccessor;967}968969/*970* Set an accessor object for the java.awt.Frame class.971*/972public static void setFrameAccessor(FrameAccessor fa) {973frameAccessor = fa;974}975976/*977* Retrieve the accessor object for the java.awt.Frame class.978*/979public static FrameAccessor getFrameAccessor() {980if (frameAccessor == null) {981ensureClassInitialized(Frame.class);982}983return frameAccessor;984}985986/*987* Set an accessor object for the java.awt.KeyboardFocusManager class.988*/989public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {990kfmAccessor = kfma;991}992993/*994* Retrieve the accessor object for the java.awt.KeyboardFocusManager class.995*/996public static KeyboardFocusManagerAccessor getKeyboardFocusManagerAccessor() {997if (kfmAccessor == null) {998ensureClassInitialized(KeyboardFocusManager.class);999}1000return kfmAccessor;1001}10021003/*1004* Set an accessor object for the java.awt.MenuComponent class.1005*/1006public static void setMenuComponentAccessor(MenuComponentAccessor mca) {1007menuComponentAccessor = mca;1008}10091010/*1011* Retrieve the accessor object for the java.awt.MenuComponent class.1012*/1013public static MenuComponentAccessor getMenuComponentAccessor() {1014if (menuComponentAccessor == null) {1015ensureClassInitialized(MenuComponent.class);1016}1017return menuComponentAccessor;1018}10191020/*1021* Set an accessor object for the java.awt.EventQueue class.1022*/1023public static void setEventQueueAccessor(EventQueueAccessor eqa) {1024eventQueueAccessor = eqa;1025}10261027/*1028* Retrieve the accessor object for the java.awt.EventQueue class.1029*/1030public static EventQueueAccessor getEventQueueAccessor() {1031if (eventQueueAccessor == null) {1032ensureClassInitialized(EventQueue.class);1033}1034return eventQueueAccessor;1035}10361037/*1038* Set an accessor object for the java.awt.PopupMenu class.1039*/1040public static void setPopupMenuAccessor(PopupMenuAccessor pma) {1041popupMenuAccessor = pma;1042}10431044/*1045* Retrieve the accessor object for the java.awt.PopupMenu class.1046*/1047public static PopupMenuAccessor getPopupMenuAccessor() {1048if (popupMenuAccessor == null) {1049ensureClassInitialized(PopupMenu.class);1050}1051return popupMenuAccessor;1052}10531054/*1055* Set an accessor object for the java.awt.FileDialog class.1056*/1057public static void setFileDialogAccessor(FileDialogAccessor fda) {1058fileDialogAccessor = fda;1059}10601061/*1062* Retrieve the accessor object for the java.awt.FileDialog class.1063*/1064public static FileDialogAccessor getFileDialogAccessor() {1065if (fileDialogAccessor == null) {1066ensureClassInitialized(FileDialog.class);1067}1068return fileDialogAccessor;1069}10701071/*1072* Set an accessor object for the java.awt.ScrollPaneAdjustable class.1073*/1074public static void setScrollPaneAdjustableAccessor(ScrollPaneAdjustableAccessor adj) {1075scrollPaneAdjustableAccessor = adj;1076}10771078/*1079* Retrieve the accessor object for the java.awt.ScrollPaneAdjustable1080* class.1081*/1082public static ScrollPaneAdjustableAccessor getScrollPaneAdjustableAccessor() {1083if (scrollPaneAdjustableAccessor == null) {1084ensureClassInitialized(ScrollPaneAdjustable.class);1085}1086return scrollPaneAdjustableAccessor;1087}10881089/**1090* Set an accessor object for the java.awt.CheckboxMenuItem class.1091*/1092public static void setCheckboxMenuItemAccessor(CheckboxMenuItemAccessor cmia) {1093checkboxMenuItemAccessor = cmia;1094}10951096/**1097* Retrieve the accessor object for the java.awt.CheckboxMenuItem class.1098*/1099public static CheckboxMenuItemAccessor getCheckboxMenuItemAccessor() {1100if (checkboxMenuItemAccessor == null) {1101ensureClassInitialized(CheckboxMenuItemAccessor.class);1102}1103return checkboxMenuItemAccessor;1104}11051106/**1107* Set an accessor object for the java.awt.Cursor class.1108*/1109public static void setCursorAccessor(CursorAccessor ca) {1110cursorAccessor = ca;1111}11121113/**1114* Retrieve the accessor object for the java.awt.Cursor class.1115*/1116public static CursorAccessor getCursorAccessor() {1117if (cursorAccessor == null) {1118ensureClassInitialized(CursorAccessor.class);1119}1120return cursorAccessor;1121}11221123/**1124* Set an accessor object for the java.awt.MenuBar class.1125*/1126public static void setMenuBarAccessor(MenuBarAccessor mba) {1127menuBarAccessor = mba;1128}11291130/**1131* Retrieve the accessor object for the java.awt.MenuBar class.1132*/1133public static MenuBarAccessor getMenuBarAccessor() {1134if (menuBarAccessor == null) {1135ensureClassInitialized(MenuBarAccessor.class);1136}1137return menuBarAccessor;1138}11391140/**1141* Set an accessor object for the java.awt.MenuItem class.1142*/1143public static void setMenuItemAccessor(MenuItemAccessor mia) {1144menuItemAccessor = mia;1145}11461147/**1148* Retrieve the accessor object for the java.awt.MenuItem class.1149*/1150public static MenuItemAccessor getMenuItemAccessor() {1151if (menuItemAccessor == null) {1152ensureClassInitialized(MenuItemAccessor.class);1153}1154return menuItemAccessor;1155}11561157/**1158* Set an accessor object for the java.awt.Menu class.1159*/1160public static void setMenuAccessor(MenuAccessor ma) {1161menuAccessor = ma;1162}11631164/**1165* Retrieve the accessor object for the java.awt.Menu class.1166*/1167public static MenuAccessor getMenuAccessor() {1168if (menuAccessor == null) {1169ensureClassInitialized(MenuAccessor.class);1170}1171return menuAccessor;1172}11731174/**1175* Set an accessor object for the java.awt.event.KeyEvent class.1176*/1177public static void setKeyEventAccessor(KeyEventAccessor kea) {1178keyEventAccessor = kea;1179}11801181/**1182* Retrieve the accessor object for the java.awt.event.KeyEvent class.1183*/1184public static KeyEventAccessor getKeyEventAccessor() {1185if (keyEventAccessor == null) {1186ensureClassInitialized(KeyEventAccessor.class);1187}1188return keyEventAccessor;1189}11901191/**1192* Set an accessor object for the javax.swing.ClientPropertyKey class.1193*/1194public static void setClientPropertyKeyAccessor(ClientPropertyKeyAccessor cpka) {1195clientPropertyKeyAccessor = cpka;1196}11971198/**1199* Retrieve the accessor object for the javax.swing.ClientPropertyKey class.1200*/1201public static ClientPropertyKeyAccessor getClientPropertyKeyAccessor() {1202if (clientPropertyKeyAccessor == null) {1203ensureClassInitialized(ClientPropertyKeyAccessor.class);1204}1205return clientPropertyKeyAccessor;1206}12071208/**1209* Set an accessor object for the java.awt.SystemTray class.1210*/1211public static void setSystemTrayAccessor(SystemTrayAccessor sta) {1212systemTrayAccessor = sta;1213}12141215/**1216* Retrieve the accessor object for the java.awt.SystemTray class.1217*/1218public static SystemTrayAccessor getSystemTrayAccessor() {1219if (systemTrayAccessor == null) {1220ensureClassInitialized(SystemTrayAccessor.class);1221}1222return systemTrayAccessor;1223}12241225/**1226* Set an accessor object for the java.awt.TrayIcon class.1227*/1228public static void setTrayIconAccessor(TrayIconAccessor tia) {1229trayIconAccessor = tia;1230}12311232/**1233* Retrieve the accessor object for the java.awt.TrayIcon class.1234*/1235public static TrayIconAccessor getTrayIconAccessor() {1236if (trayIconAccessor == null) {1237ensureClassInitialized(TrayIconAccessor.class);1238}1239return trayIconAccessor;1240}12411242/**1243* Set an accessor object for the java.awt.DefaultKeyboardFocusManager class.1244*/1245public static void setDefaultKeyboardFocusManagerAccessor(DefaultKeyboardFocusManagerAccessor dkfma) {1246defaultKeyboardFocusManagerAccessor = dkfma;1247}12481249/**1250* Retrieve the accessor object for the java.awt.DefaultKeyboardFocusManager class.1251*/1252public static DefaultKeyboardFocusManagerAccessor getDefaultKeyboardFocusManagerAccessor() {1253if (defaultKeyboardFocusManagerAccessor == null) {1254ensureClassInitialized(DefaultKeyboardFocusManagerAccessor.class);1255}1256return defaultKeyboardFocusManagerAccessor;1257}1258/*1259* Set an accessor object for the java.awt.SequencedEvent class.1260*/1261public static void setSequencedEventAccessor(SequencedEventAccessor sea) {1262sequencedEventAccessor = sea;1263}12641265/*1266* Get the accessor object for the java.awt.SequencedEvent class.1267*/1268public static SequencedEventAccessor getSequencedEventAccessor() {1269if (sequencedEventAccessor == null) {1270try {1271ensureClassInitialized(1272Class.forName("java.awt.SequencedEvent"));1273} catch (ClassNotFoundException ignore) {1274}1275}1276return sequencedEventAccessor;1277}12781279/*1280* Set an accessor object for the java.awt.Toolkit class.1281*/1282public static void setToolkitAccessor(ToolkitAccessor ta) {1283toolkitAccessor = ta;1284}12851286/*1287* Get the accessor object for the java.awt.Toolkit class.1288*/1289public static ToolkitAccessor getToolkitAccessor() {1290if (toolkitAccessor == null) {1291ensureClassInitialized(Toolkit.class);1292}12931294return toolkitAccessor;1295}12961297/*1298* Get the accessor object for the java.awt.event.InvocationEvent class.1299*/1300public static void setInvocationEventAccessor(InvocationEventAccessor invocationEventAccessor) {1301AWTAccessor.invocationEventAccessor = invocationEventAccessor;1302}13031304/*1305* Set the accessor object for the java.awt.event.InvocationEvent class.1306*/1307public static InvocationEventAccessor getInvocationEventAccessor() {1308return invocationEventAccessor;1309}13101311/*1312* Get the accessor object for the java.awt.SystemColor class.1313*/1314public static SystemColorAccessor getSystemColorAccessor() {1315if (systemColorAccessor == null) {1316ensureClassInitialized(SystemColor.class);1317}13181319return systemColorAccessor;1320}13211322/*1323* Set the accessor object for the java.awt.SystemColor class.1324*/1325public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {1326AWTAccessor.systemColorAccessor = systemColorAccessor;1327}13281329/*1330* Get the accessor object for the javax.accessibility.AccessibleContext class.1331*/1332public static AccessibleContextAccessor getAccessibleContextAccessor() {1333if (accessibleContextAccessor == null) {1334ensureClassInitialized(AccessibleContext.class);1335}1336return accessibleContextAccessor;1337}13381339/*1340* Set the accessor object for the javax.accessibility.AccessibleBundle class.1341*/1342public static void setAccessibleBundleAccessor(AccessibleBundleAccessor accessor) {1343AWTAccessor.accessibleBundleAccessor = accessor;1344}13451346/*1347* Get the accessor object for the javax.accessibility.AccessibleBundle class.1348*/1349public static AccessibleBundleAccessor getAccessibleBundleAccessor() {1350if (accessibleBundleAccessor == null) {1351ensureClassInitialized(AccessibleBundle.class);1352}1353return accessibleBundleAccessor;1354}13551356/*1357* Set the accessor object for the javax.accessibility.AccessibleContext class.1358*/1359public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) {1360AWTAccessor.accessibleContextAccessor = accessor;1361}13621363/*1364* Get the accessor object for the java.awt.dnd.DragSourceContext class.1365*/1366public static DragSourceContextAccessor getDragSourceContextAccessor() {1367if (dragSourceContextAccessor == null) {1368ensureClassInitialized(DragSourceContext.class);1369}1370return dragSourceContextAccessor;1371}13721373/*1374* Set the accessor object for the java.awt.dnd.DragSourceContext class.1375*/1376public static void setDragSourceContextAccessor(DragSourceContextAccessor accessor) {1377AWTAccessor.dragSourceContextAccessor = accessor;1378}13791380/*1381* Get the accessor object for the java.awt.dnd.DropTargetContext class.1382*/1383public static DropTargetContextAccessor getDropTargetContextAccessor() {1384if (dropTargetContextAccessor == null) {1385ensureClassInitialized(DropTargetContext.class);1386}1387return dropTargetContextAccessor;1388}13891390/*1391* Set the accessor object for the java.awt.dnd.DropTargetContext class.1392*/1393public static void setDropTargetContextAccessor(DropTargetContextAccessor accessor) {1394AWTAccessor.dropTargetContextAccessor = accessor;1395}13961397private static void ensureClassInitialized(Class<?> c) {1398try {1399MethodHandles.lookup().ensureInitialized(c);1400} catch (IllegalAccessException e) {}1401}1402}140314041405