Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/sun/awt/AWTAccessor.java
41152 views
1
/*
2
* Copyright (c) 2008, 2021, 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 javax.accessibility.AccessibleContext;
29
import java.awt.*;
30
import java.awt.event.FocusEvent.Cause;
31
import java.awt.dnd.DragSourceContext;
32
import java.awt.dnd.DropTargetContext;
33
import java.awt.dnd.peer.DragSourceContextPeer;
34
import java.awt.dnd.peer.DropTargetContextPeer;
35
import java.awt.event.InputEvent;
36
import java.awt.event.InvocationEvent;
37
import java.awt.event.KeyEvent;
38
import java.awt.event.MouseEvent;
39
import java.awt.geom.Point2D;
40
import java.awt.image.BufferStrategy;
41
import java.awt.peer.ComponentPeer;
42
43
import java.awt.peer.MenuComponentPeer;
44
import java.lang.invoke.MethodHandles;
45
import java.lang.reflect.InvocationTargetException;
46
import java.security.AccessControlContext;
47
48
import java.io.File;
49
import java.util.ResourceBundle;
50
import java.util.Vector;
51
import javax.accessibility.AccessibleBundle;
52
53
/**
54
* The AWTAccessor utility class.
55
* The main purpose of this class is to enable accessing
56
* private and package-private fields of classes from
57
* different classes/packages. See sun.misc.SharedSecretes
58
* for another example.
59
*/
60
public final class AWTAccessor {
61
62
/*
63
* We don't need any objects of this class.
64
* It's rather a collection of static methods
65
* and interfaces.
66
*/
67
private AWTAccessor() {
68
}
69
70
/*
71
* An interface of accessor for the java.awt.Component class.
72
*/
73
public interface ComponentAccessor {
74
/*
75
* Sets whether the native background erase for a component
76
* has been disabled via SunToolkit.disableBackgroundErase().
77
*/
78
void setBackgroundEraseDisabled(Component comp, boolean disabled);
79
/*
80
* Indicates whether the native background erase for a
81
* component has been disabled via
82
* SunToolkit.disableBackgroundErase().
83
*/
84
boolean getBackgroundEraseDisabled(Component comp);
85
/*
86
*
87
* Gets the bounds of this component in the form of a
88
* {@code Rectangle} object. The bounds specify this
89
* component's width, height, and location relative to
90
* its parent.
91
*/
92
Rectangle getBounds(Component comp);
93
94
/**
95
* Sets GraphicsConfiguration value for the component.
96
*/
97
void setGraphicsConfiguration(Component comp, GraphicsConfiguration gc);
98
/*
99
* Requests focus to the component.
100
*/
101
void requestFocus(Component comp, Cause cause);
102
/*
103
* Determines if the component can gain focus.
104
*/
105
boolean canBeFocusOwner(Component comp);
106
107
/**
108
* Returns whether the component is visible without invoking
109
* any client code.
110
*/
111
boolean isVisible(Component comp);
112
113
/**
114
* Sets the RequestFocusController.
115
*/
116
void setRequestFocusController(RequestFocusController requestController);
117
118
/**
119
* Returns the appContext of the component.
120
*/
121
AppContext getAppContext(Component comp);
122
123
/**
124
* Sets the appContext of the component.
125
*/
126
void setAppContext(Component comp, AppContext appContext);
127
128
/**
129
* Returns the parent of the component.
130
*/
131
Container getParent(Component comp);
132
133
/**
134
* Sets the parent of the component to the specified parent.
135
*/
136
void setParent(Component comp, Container parent);
137
138
/**
139
* Resizes the component to the specified width and height.
140
*/
141
void setSize(Component comp, int width, int height);
142
143
/**
144
* Returns the location of the component.
145
*/
146
Point getLocation(Component comp);
147
148
/**
149
* Moves the component to the new location.
150
*/
151
void setLocation(Component comp, int x, int y);
152
153
/**
154
* Determines whether this component is enabled.
155
*/
156
boolean isEnabled(Component comp);
157
158
/**
159
* Determines whether this component is displayable.
160
*/
161
boolean isDisplayable(Component comp);
162
163
/**
164
* Gets the cursor set in the component.
165
*/
166
Cursor getCursor(Component comp);
167
168
/**
169
* Returns the peer of the component.
170
*/
171
<T extends ComponentPeer> T getPeer(Component comp);
172
173
/**
174
* Sets the peer of the component to the specified peer.
175
*/
176
void setPeer(Component comp, ComponentPeer peer);
177
178
/**
179
* Determines whether this component is lightweight.
180
*/
181
boolean isLightweight(Component comp);
182
183
/**
184
* Returns whether or not paint messages received from
185
* the operating system should be ignored.
186
*/
187
boolean getIgnoreRepaint(Component comp);
188
189
/**
190
* Returns the width of the component.
191
*/
192
int getWidth(Component comp);
193
194
/**
195
* Returns the height of the component.
196
*/
197
int getHeight(Component comp);
198
199
/**
200
* Returns the x coordinate of the component.
201
*/
202
int getX(Component comp);
203
204
/**
205
* Returns the y coordinate of the component.
206
*/
207
int getY(Component comp);
208
209
/**
210
* Gets the foreground color of this component.
211
*/
212
Color getForeground(Component comp);
213
214
/**
215
* Gets the background color of this component.
216
*/
217
Color getBackground(Component comp);
218
219
/**
220
* Sets the background of this component to the specified color.
221
*/
222
void setBackground(Component comp, Color background);
223
224
/**
225
* Gets the font of the component.
226
*/
227
Font getFont(Component comp);
228
229
/**
230
* Processes events occurring on this component.
231
*/
232
void processEvent(Component comp, AWTEvent e);
233
234
235
/*
236
* Returns the acc this component was constructed with.
237
*/
238
@SuppressWarnings("removal")
239
AccessControlContext getAccessControlContext(Component comp);
240
241
/**
242
* Revalidates the component synchronously.
243
*/
244
void revalidateSynchronously(Component comp);
245
246
/**
247
* Creates a new strategy for multi-buffering on this component.
248
*/
249
void createBufferStrategy(Component comp, int numBuffers,
250
BufferCapabilities caps) throws AWTException;
251
252
/**
253
* returns the buffer strategy used by this component.
254
*/
255
BufferStrategy getBufferStrategy(Component comp);
256
}
257
258
/*
259
* An interface of accessor for the java.awt.Container class.
260
*/
261
public interface ContainerAccessor {
262
/**
263
* Validates the container unconditionally.
264
*/
265
void validateUnconditionally(Container cont);
266
267
/**
268
*
269
* Access to the private version of findComponentAt method which has
270
* a controllable behavior. Setting 'ignoreEnabled' to 'false'
271
* bypasses disabled Components during the search.
272
*/
273
Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled);
274
275
/**
276
* Starts LW Modal.
277
*/
278
void startLWModal(Container cont);
279
280
/**
281
* Starts LW Modal.
282
*/
283
void stopLWModal(Container cont);
284
}
285
286
/*
287
* An interface of accessor for java.awt.Window class.
288
*/
289
public interface WindowAccessor {
290
/*
291
* Update the image of a non-opaque (translucent) window.
292
*/
293
void updateWindow(Window window);
294
295
/**
296
* Set the size of the security warning.
297
*/
298
void setSecurityWarningSize(Window w, int width, int height);
299
300
/** Request to recalculate the new position of the security warning for
301
* the given window size/location as reported by the native system.
302
*/
303
Point2D calculateSecurityWarningPosition(Window window,
304
double x, double y, double w, double h);
305
306
/** Sets the synchronous status of focus requests on lightweight
307
* components in the specified window to the specified value.
308
*/
309
void setLWRequestStatus(Window changed, boolean status);
310
311
/**
312
* Indicates whether this window should receive focus on subsequently
313
* being shown, or being moved to the front.
314
*/
315
boolean isAutoRequestFocus(Window w);
316
317
/**
318
* Indicates whether the specified window is an utility window for TrayIcon.
319
*/
320
boolean isTrayIconWindow(Window w);
321
322
/**
323
* Marks the specified window as an utility window for TrayIcon.
324
*/
325
void setTrayIconWindow(Window w, boolean isTrayIconWindow);
326
327
/**
328
* Return an array containing all the windows this
329
* window currently owns.
330
*/
331
Window[] getOwnedWindows(Window w);
332
}
333
334
/**
335
* An accessor for the AWTEvent class.
336
*/
337
public interface AWTEventAccessor {
338
/**
339
* Marks the event as posted.
340
*/
341
void setPosted(AWTEvent ev);
342
343
/**
344
* Sets the flag on this AWTEvent indicating that it was
345
* generated by the system.
346
*/
347
void setSystemGenerated(AWTEvent ev);
348
349
/**
350
* Indicates whether this AWTEvent was generated by the system.
351
*/
352
boolean isSystemGenerated(AWTEvent ev);
353
354
/**
355
* Returns the acc this event was constructed with.
356
*/
357
@SuppressWarnings("removal")
358
AccessControlContext getAccessControlContext(AWTEvent ev);
359
360
/**
361
* Returns binary data associated with this event;
362
*/
363
byte[] getBData(AWTEvent ev);
364
365
/**
366
* Associates binary data with this event;
367
*/
368
void setBData(AWTEvent ev, byte[] bdata);
369
}
370
371
public interface InputEventAccessor {
372
/*
373
* Accessor for InputEvent.getButtonDownMasks()
374
*/
375
int[] getButtonDownMasks();
376
377
/*
378
* Accessor for InputEvent.canAccessSystemClipboard field
379
*/
380
boolean canAccessSystemClipboard(InputEvent event);
381
void setCanAccessSystemClipboard(InputEvent event,
382
boolean canAccessSystemClipboard);
383
}
384
385
/**
386
* An accessor for the MouseEvent class.
387
*/
388
public interface MouseEventAccessor {
389
/**
390
* Indicates whether the event is a result of a touch event.
391
*/
392
boolean isCausedByTouchEvent(MouseEvent ev);
393
394
/**
395
* Sets whether the event is a result of a touch event.
396
*/
397
void setCausedByTouchEvent(MouseEvent ev, boolean causedByTouchEvent);
398
}
399
400
/*
401
* An accessor for the java.awt.Frame class.
402
*/
403
public interface FrameAccessor {
404
/*
405
* Sets the state of this frame.
406
*/
407
void setExtendedState(Frame frame, int state);
408
/*
409
* Gets the state of this frame.
410
*/
411
int getExtendedState(Frame frame);
412
/*
413
* Gets the maximized bounds of this frame.
414
*/
415
Rectangle getMaximizedBounds(Frame frame);
416
}
417
418
/**
419
* An interface of accessor for the java.awt.KeyboardFocusManager class.
420
*/
421
public interface KeyboardFocusManagerAccessor {
422
/**
423
* Indicates whether the native implementation should
424
* proceed with a pending focus request for the heavyweight.
425
*/
426
int shouldNativelyFocusHeavyweight(Component heavyweight,
427
Component descendant,
428
boolean temporary,
429
boolean focusedWindowChangeAllowed,
430
long time,
431
Cause cause);
432
/**
433
* Delivers focus for the lightweight descendant of the heavyweight
434
* synchronously.
435
*/
436
boolean processSynchronousLightweightTransfer(Component heavyweight,
437
Component descendant,
438
boolean temporary,
439
boolean focusedWindowChangeAllowed,
440
long time);
441
/**
442
* Removes the last focus request for the heavyweight from the queue.
443
*/
444
void removeLastFocusRequest(Component heavyweight);
445
446
/**
447
* Gets the most recent focus owner in the window.
448
*/
449
Component getMostRecentFocusOwner(Window window);
450
451
/**
452
* Sets the most recent focus owner in the window.
453
*/
454
void setMostRecentFocusOwner(Window window, Component component);
455
456
/**
457
* Returns current KFM of the specified AppContext.
458
*/
459
KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx);
460
461
/**
462
* Return the current focus cycle root
463
*/
464
Container getCurrentFocusCycleRoot();
465
}
466
467
/**
468
* An accessor for the MenuComponent class.
469
*/
470
public interface MenuComponentAccessor {
471
/**
472
* Returns the appContext of the menu component.
473
*/
474
AppContext getAppContext(MenuComponent menuComp);
475
476
/**
477
* Sets the appContext of the menu component.
478
*/
479
void setAppContext(MenuComponent menuComp, AppContext appContext);
480
481
/**
482
* Returns the peer of the menu component.
483
*/
484
<T extends MenuComponentPeer> T getPeer(MenuComponent menuComp);
485
486
/**
487
* Returns the menu container of the menu component.
488
*/
489
MenuContainer getParent(MenuComponent menuComp);
490
491
/**
492
* Sets the menu container of the menu component.
493
*/
494
void setParent(MenuComponent menuComp, MenuContainer menuContainer);
495
496
/**
497
* Gets the font used for this menu component.
498
*/
499
Font getFont_NoClientCode(MenuComponent menuComp);
500
}
501
502
/**
503
* An accessor for the EventQueue class
504
*/
505
public interface EventQueueAccessor {
506
/**
507
* Gets the event dispatch thread.
508
*/
509
Thread getDispatchThread(EventQueue eventQueue);
510
511
/**
512
* Checks if the current thread is EDT for the given EQ.
513
*/
514
public boolean isDispatchThreadImpl(EventQueue eventQueue);
515
516
/**
517
* Removes any pending events for the specified source object.
518
*/
519
void removeSourceEvents(EventQueue eventQueue, Object source, boolean removeAllEvents);
520
521
/**
522
* Returns whether an event is pending on any of the separate Queues.
523
*/
524
boolean noEvents(EventQueue eventQueue);
525
526
/**
527
* Called from PostEventQueue.postEvent to notify that a new event
528
* appeared.
529
*/
530
void wakeup(EventQueue eventQueue, boolean isShutdown);
531
532
/**
533
* Static in EventQueue
534
*/
535
void invokeAndWait(Object source, Runnable r)
536
throws InterruptedException, InvocationTargetException;
537
538
/**
539
* Sets the delegate for the EventQueue used by FX/AWT single threaded mode
540
*/
541
void setFwDispatcher(EventQueue eventQueue, FwDispatcher dispatcher);
542
543
/**
544
* Gets most recent event time in the EventQueue
545
*/
546
long getMostRecentEventTime(EventQueue eventQueue);
547
}
548
549
/*
550
* An accessor for the PopupMenu class
551
*/
552
public interface PopupMenuAccessor {
553
/*
554
* Returns whether the popup menu is attached to a tray
555
*/
556
boolean isTrayIconPopup(PopupMenu popupMenu);
557
}
558
559
/*
560
* An accessor for the FileDialog class
561
*/
562
public interface FileDialogAccessor {
563
/*
564
* Sets the files the user selects
565
*/
566
void setFiles(FileDialog fileDialog, File[] files);
567
568
/*
569
* Sets the file the user selects
570
*/
571
void setFile(FileDialog fileDialog, String file);
572
573
/*
574
* Sets the directory the user selects
575
*/
576
void setDirectory(FileDialog fileDialog, String directory);
577
578
/*
579
* Returns whether the file dialog allows the multiple file selection.
580
*/
581
boolean isMultipleMode(FileDialog fileDialog);
582
}
583
584
/*
585
* An accessor for the ScrollPaneAdjustable class.
586
*/
587
public interface ScrollPaneAdjustableAccessor {
588
/*
589
* Sets the value of this scrollbar to the specified value.
590
*/
591
void setTypedValue(final ScrollPaneAdjustable adj, final int v,
592
final int type);
593
}
594
595
/**
596
* An accessor for the CheckboxMenuItem class
597
*/
598
public interface CheckboxMenuItemAccessor {
599
/**
600
* Returns whether menu item is checked
601
*/
602
boolean getState(CheckboxMenuItem cmi);
603
}
604
605
/**
606
* An accessor for the Cursor class
607
*/
608
public interface CursorAccessor {
609
/**
610
* Returns pData of the Cursor class
611
*/
612
long getPData(Cursor cursor);
613
614
/**
615
* Sets pData to the Cursor class
616
*/
617
void setPData(Cursor cursor, long pData);
618
619
/**
620
* Return type of the Cursor class
621
*/
622
int getType(Cursor cursor);
623
}
624
625
/**
626
* An accessor for the MenuBar class
627
*/
628
public interface MenuBarAccessor {
629
/**
630
* Returns help menu
631
*/
632
Menu getHelpMenu(MenuBar menuBar);
633
634
/**
635
* Returns menus
636
*/
637
Vector<Menu> getMenus(MenuBar menuBar);
638
}
639
640
/**
641
* An accessor for the MenuItem class
642
*/
643
public interface MenuItemAccessor {
644
/**
645
* Returns whether menu item is enabled
646
*/
647
boolean isEnabled(MenuItem item);
648
649
/**
650
* Gets the command name of the action event that is fired
651
* by this menu item.
652
*/
653
String getActionCommandImpl(MenuItem item);
654
655
/**
656
* Returns true if the item and all its ancestors are
657
* enabled, false otherwise
658
*/
659
boolean isItemEnabled(MenuItem item);
660
661
/**
662
* Returns label
663
*/
664
String getLabel(MenuItem item);
665
666
/**
667
* Returns shortcut
668
*/
669
MenuShortcut getShortcut(MenuItem item);
670
}
671
672
/**
673
* An accessor for the Menu class
674
*/
675
public interface MenuAccessor {
676
/**
677
* Returns vector of the items that are part of the Menu
678
*/
679
Vector<MenuItem> getItems(Menu menu);
680
}
681
682
/**
683
* An accessor for the KeyEvent class
684
*/
685
public interface KeyEventAccessor {
686
/**
687
* Sets rawCode field for KeyEvent
688
*/
689
void setRawCode(KeyEvent ev, long rawCode);
690
691
/**
692
* Sets primaryLevelUnicode field for KeyEvent
693
*/
694
void setPrimaryLevelUnicode(KeyEvent ev, long primaryLevelUnicode);
695
696
/**
697
* Sets extendedKeyCode field for KeyEvent
698
*/
699
void setExtendedKeyCode(KeyEvent ev, long extendedKeyCode);
700
701
/**
702
* Gets original source for KeyEvent
703
*/
704
Component getOriginalSource(KeyEvent ev);
705
706
/**
707
* Gets isProxyActive field for KeyEvent
708
*/
709
boolean isProxyActive(KeyEvent ev);
710
}
711
712
/**
713
* An accessor for the ClientPropertyKey class
714
*/
715
public interface ClientPropertyKeyAccessor {
716
/**
717
* Retrieves JComponent_TRANSFER_HANDLER enum object
718
*/
719
Object getJComponent_TRANSFER_HANDLER();
720
}
721
722
/**
723
* An accessor for the SystemTray class
724
*/
725
public interface SystemTrayAccessor {
726
/**
727
* Support for reporting bound property changes for Object properties.
728
*/
729
void firePropertyChange(SystemTray tray, String propertyName, Object oldValue, Object newValue);
730
}
731
732
/**
733
* An accessor for the TrayIcon class
734
*/
735
public interface TrayIconAccessor {
736
void addNotify(TrayIcon trayIcon) throws AWTException;
737
void removeNotify(TrayIcon trayIcon);
738
}
739
740
/**
741
* An accessor for the DefaultKeyboardFocusManager class
742
*/
743
public interface DefaultKeyboardFocusManagerAccessor {
744
public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e);
745
}
746
747
/*
748
* An accessor for the SequencedEventAccessor class
749
*/
750
public interface SequencedEventAccessor {
751
/*
752
* Returns the nested event.
753
*/
754
AWTEvent getNested(AWTEvent sequencedEvent);
755
756
/*
757
* Returns true if the event is an instances of SequencedEvent.
758
*/
759
boolean isSequencedEvent(AWTEvent event);
760
761
/*
762
* Creates SequencedEvent with the given nested event
763
*/
764
AWTEvent create(AWTEvent event);
765
}
766
767
/*
768
* An accessor for the Toolkit class
769
*/
770
public interface ToolkitAccessor {
771
void setPlatformResources(ResourceBundle bundle);
772
}
773
774
/*
775
* An accessor object for the InvocationEvent class
776
*/
777
public interface InvocationEventAccessor {
778
void dispose(InvocationEvent event);
779
}
780
781
/*
782
* An accessor object for the SystemColor class
783
*/
784
public interface SystemColorAccessor {
785
void updateSystemColors();
786
}
787
788
/*
789
* An accessor object for the AccessibleContext class
790
*/
791
public interface AccessibleContextAccessor {
792
void setAppContext(AccessibleContext accessibleContext, AppContext appContext);
793
AppContext getAppContext(AccessibleContext accessibleContext);
794
Object getNativeAXResource(AccessibleContext accessibleContext);
795
void setNativeAXResource(AccessibleContext accessibleContext, Object value);
796
}
797
798
/*
799
* An accessor object for the AccessibleContext class
800
*/
801
public interface AccessibleBundleAccessor {
802
String getKey(AccessibleBundle accessibleBundle);
803
}
804
805
/*
806
* An accessor object for the DragSourceContext class
807
*/
808
public interface DragSourceContextAccessor {
809
/**
810
* Returns the peer of the DragSourceContext.
811
*/
812
DragSourceContextPeer getPeer(DragSourceContext dsc);
813
}
814
815
/*
816
* An accessor object for the DropTargetContext class
817
*/
818
public interface DropTargetContextAccessor {
819
/**
820
* Resets the DropTargetContext.
821
*/
822
void reset(DropTargetContext dtc);
823
/**
824
* Sets the {@code DropTargetContextPeer}
825
*/
826
void setDropTargetContextPeer(DropTargetContext dtc,
827
DropTargetContextPeer dtcp);
828
}
829
830
/*
831
* Accessor instances are initialized in the static initializers of
832
* corresponding AWT classes by using setters defined below.
833
*/
834
private static ComponentAccessor componentAccessor;
835
private static ContainerAccessor containerAccessor;
836
private static WindowAccessor windowAccessor;
837
private static AWTEventAccessor awtEventAccessor;
838
private static InputEventAccessor inputEventAccessor;
839
private static MouseEventAccessor mouseEventAccessor;
840
private static FrameAccessor frameAccessor;
841
private static KeyboardFocusManagerAccessor kfmAccessor;
842
private static MenuComponentAccessor menuComponentAccessor;
843
private static EventQueueAccessor eventQueueAccessor;
844
private static PopupMenuAccessor popupMenuAccessor;
845
private static FileDialogAccessor fileDialogAccessor;
846
private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
847
private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;
848
private static CursorAccessor cursorAccessor;
849
private static MenuBarAccessor menuBarAccessor;
850
private static MenuItemAccessor menuItemAccessor;
851
private static MenuAccessor menuAccessor;
852
private static KeyEventAccessor keyEventAccessor;
853
private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;
854
private static SystemTrayAccessor systemTrayAccessor;
855
private static TrayIconAccessor trayIconAccessor;
856
private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
857
private static SequencedEventAccessor sequencedEventAccessor;
858
private static ToolkitAccessor toolkitAccessor;
859
private static InvocationEventAccessor invocationEventAccessor;
860
private static SystemColorAccessor systemColorAccessor;
861
private static AccessibleContextAccessor accessibleContextAccessor;
862
private static AccessibleBundleAccessor accessibleBundleAccessor;
863
private static DragSourceContextAccessor dragSourceContextAccessor;
864
private static DropTargetContextAccessor dropTargetContextAccessor;
865
866
/*
867
* Set an accessor object for the java.awt.Component class.
868
*/
869
public static void setComponentAccessor(ComponentAccessor ca) {
870
componentAccessor = ca;
871
}
872
873
/*
874
* Retrieve the accessor object for the java.awt.Component class.
875
*/
876
public static ComponentAccessor getComponentAccessor() {
877
if (componentAccessor == null) {
878
ensureClassInitialized(Component.class);
879
}
880
881
return componentAccessor;
882
}
883
884
/*
885
* Set an accessor object for the java.awt.Container class.
886
*/
887
public static void setContainerAccessor(ContainerAccessor ca) {
888
containerAccessor = ca;
889
}
890
891
/*
892
* Retrieve the accessor object for the java.awt.Container class.
893
*/
894
public static ContainerAccessor getContainerAccessor() {
895
if (containerAccessor == null) {
896
ensureClassInitialized(Container.class);
897
}
898
899
return containerAccessor;
900
}
901
902
/*
903
* Set an accessor object for the java.awt.Window class.
904
*/
905
public static void setWindowAccessor(WindowAccessor wa) {
906
windowAccessor = wa;
907
}
908
909
/*
910
* Retrieve the accessor object for the java.awt.Window class.
911
*/
912
public static WindowAccessor getWindowAccessor() {
913
if (windowAccessor == null) {
914
ensureClassInitialized(Window.class);
915
}
916
return windowAccessor;
917
}
918
919
/*
920
* Set an accessor object for the java.awt.AWTEvent class.
921
*/
922
public static void setAWTEventAccessor(AWTEventAccessor aea) {
923
awtEventAccessor = aea;
924
}
925
926
/*
927
* Retrieve the accessor object for the java.awt.AWTEvent class.
928
*/
929
public static AWTEventAccessor getAWTEventAccessor() {
930
if (awtEventAccessor == null) {
931
ensureClassInitialized(AWTEvent.class);
932
}
933
return awtEventAccessor;
934
}
935
936
/*
937
* Set an accessor object for the java.awt.event.InputEvent class.
938
*/
939
public static void setInputEventAccessor(InputEventAccessor iea) {
940
inputEventAccessor = iea;
941
}
942
943
/*
944
* Retrieve the accessor object for the java.awt.event.InputEvent class.
945
*/
946
public static InputEventAccessor getInputEventAccessor() {
947
if (inputEventAccessor == null) {
948
ensureClassInitialized(InputEvent.class);
949
}
950
return inputEventAccessor;
951
}
952
953
/*
954
* Set an accessor object for the java.awt.event.MouseEvent class.
955
*/
956
public static void setMouseEventAccessor(MouseEventAccessor mea) {
957
mouseEventAccessor = mea;
958
}
959
960
/*
961
* Retrieve the accessor object for the java.awt.event.MouseEvent class.
962
*/
963
public static MouseEventAccessor getMouseEventAccessor() {
964
if (mouseEventAccessor == null) {
965
ensureClassInitialized(MouseEvent.class);
966
}
967
return mouseEventAccessor;
968
}
969
970
/*
971
* Set an accessor object for the java.awt.Frame class.
972
*/
973
public static void setFrameAccessor(FrameAccessor fa) {
974
frameAccessor = fa;
975
}
976
977
/*
978
* Retrieve the accessor object for the java.awt.Frame class.
979
*/
980
public static FrameAccessor getFrameAccessor() {
981
if (frameAccessor == null) {
982
ensureClassInitialized(Frame.class);
983
}
984
return frameAccessor;
985
}
986
987
/*
988
* Set an accessor object for the java.awt.KeyboardFocusManager class.
989
*/
990
public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {
991
kfmAccessor = kfma;
992
}
993
994
/*
995
* Retrieve the accessor object for the java.awt.KeyboardFocusManager class.
996
*/
997
public static KeyboardFocusManagerAccessor getKeyboardFocusManagerAccessor() {
998
if (kfmAccessor == null) {
999
ensureClassInitialized(KeyboardFocusManager.class);
1000
}
1001
return kfmAccessor;
1002
}
1003
1004
/*
1005
* Set an accessor object for the java.awt.MenuComponent class.
1006
*/
1007
public static void setMenuComponentAccessor(MenuComponentAccessor mca) {
1008
menuComponentAccessor = mca;
1009
}
1010
1011
/*
1012
* Retrieve the accessor object for the java.awt.MenuComponent class.
1013
*/
1014
public static MenuComponentAccessor getMenuComponentAccessor() {
1015
if (menuComponentAccessor == null) {
1016
ensureClassInitialized(MenuComponent.class);
1017
}
1018
return menuComponentAccessor;
1019
}
1020
1021
/*
1022
* Set an accessor object for the java.awt.EventQueue class.
1023
*/
1024
public static void setEventQueueAccessor(EventQueueAccessor eqa) {
1025
eventQueueAccessor = eqa;
1026
}
1027
1028
/*
1029
* Retrieve the accessor object for the java.awt.EventQueue class.
1030
*/
1031
public static EventQueueAccessor getEventQueueAccessor() {
1032
if (eventQueueAccessor == null) {
1033
ensureClassInitialized(EventQueue.class);
1034
}
1035
return eventQueueAccessor;
1036
}
1037
1038
/*
1039
* Set an accessor object for the java.awt.PopupMenu class.
1040
*/
1041
public static void setPopupMenuAccessor(PopupMenuAccessor pma) {
1042
popupMenuAccessor = pma;
1043
}
1044
1045
/*
1046
* Retrieve the accessor object for the java.awt.PopupMenu class.
1047
*/
1048
public static PopupMenuAccessor getPopupMenuAccessor() {
1049
if (popupMenuAccessor == null) {
1050
ensureClassInitialized(PopupMenu.class);
1051
}
1052
return popupMenuAccessor;
1053
}
1054
1055
/*
1056
* Set an accessor object for the java.awt.FileDialog class.
1057
*/
1058
public static void setFileDialogAccessor(FileDialogAccessor fda) {
1059
fileDialogAccessor = fda;
1060
}
1061
1062
/*
1063
* Retrieve the accessor object for the java.awt.FileDialog class.
1064
*/
1065
public static FileDialogAccessor getFileDialogAccessor() {
1066
if (fileDialogAccessor == null) {
1067
ensureClassInitialized(FileDialog.class);
1068
}
1069
return fileDialogAccessor;
1070
}
1071
1072
/*
1073
* Set an accessor object for the java.awt.ScrollPaneAdjustable class.
1074
*/
1075
public static void setScrollPaneAdjustableAccessor(ScrollPaneAdjustableAccessor adj) {
1076
scrollPaneAdjustableAccessor = adj;
1077
}
1078
1079
/*
1080
* Retrieve the accessor object for the java.awt.ScrollPaneAdjustable
1081
* class.
1082
*/
1083
public static ScrollPaneAdjustableAccessor getScrollPaneAdjustableAccessor() {
1084
if (scrollPaneAdjustableAccessor == null) {
1085
ensureClassInitialized(ScrollPaneAdjustable.class);
1086
}
1087
return scrollPaneAdjustableAccessor;
1088
}
1089
1090
/**
1091
* Set an accessor object for the java.awt.CheckboxMenuItem class.
1092
*/
1093
public static void setCheckboxMenuItemAccessor(CheckboxMenuItemAccessor cmia) {
1094
checkboxMenuItemAccessor = cmia;
1095
}
1096
1097
/**
1098
* Retrieve the accessor object for the java.awt.CheckboxMenuItem class.
1099
*/
1100
public static CheckboxMenuItemAccessor getCheckboxMenuItemAccessor() {
1101
if (checkboxMenuItemAccessor == null) {
1102
ensureClassInitialized(CheckboxMenuItemAccessor.class);
1103
}
1104
return checkboxMenuItemAccessor;
1105
}
1106
1107
/**
1108
* Set an accessor object for the java.awt.Cursor class.
1109
*/
1110
public static void setCursorAccessor(CursorAccessor ca) {
1111
cursorAccessor = ca;
1112
}
1113
1114
/**
1115
* Retrieve the accessor object for the java.awt.Cursor class.
1116
*/
1117
public static CursorAccessor getCursorAccessor() {
1118
if (cursorAccessor == null) {
1119
ensureClassInitialized(CursorAccessor.class);
1120
}
1121
return cursorAccessor;
1122
}
1123
1124
/**
1125
* Set an accessor object for the java.awt.MenuBar class.
1126
*/
1127
public static void setMenuBarAccessor(MenuBarAccessor mba) {
1128
menuBarAccessor = mba;
1129
}
1130
1131
/**
1132
* Retrieve the accessor object for the java.awt.MenuBar class.
1133
*/
1134
public static MenuBarAccessor getMenuBarAccessor() {
1135
if (menuBarAccessor == null) {
1136
ensureClassInitialized(MenuBarAccessor.class);
1137
}
1138
return menuBarAccessor;
1139
}
1140
1141
/**
1142
* Set an accessor object for the java.awt.MenuItem class.
1143
*/
1144
public static void setMenuItemAccessor(MenuItemAccessor mia) {
1145
menuItemAccessor = mia;
1146
}
1147
1148
/**
1149
* Retrieve the accessor object for the java.awt.MenuItem class.
1150
*/
1151
public static MenuItemAccessor getMenuItemAccessor() {
1152
if (menuItemAccessor == null) {
1153
ensureClassInitialized(MenuItemAccessor.class);
1154
}
1155
return menuItemAccessor;
1156
}
1157
1158
/**
1159
* Set an accessor object for the java.awt.Menu class.
1160
*/
1161
public static void setMenuAccessor(MenuAccessor ma) {
1162
menuAccessor = ma;
1163
}
1164
1165
/**
1166
* Retrieve the accessor object for the java.awt.Menu class.
1167
*/
1168
public static MenuAccessor getMenuAccessor() {
1169
if (menuAccessor == null) {
1170
ensureClassInitialized(MenuAccessor.class);
1171
}
1172
return menuAccessor;
1173
}
1174
1175
/**
1176
* Set an accessor object for the java.awt.event.KeyEvent class.
1177
*/
1178
public static void setKeyEventAccessor(KeyEventAccessor kea) {
1179
keyEventAccessor = kea;
1180
}
1181
1182
/**
1183
* Retrieve the accessor object for the java.awt.event.KeyEvent class.
1184
*/
1185
public static KeyEventAccessor getKeyEventAccessor() {
1186
if (keyEventAccessor == null) {
1187
ensureClassInitialized(KeyEventAccessor.class);
1188
}
1189
return keyEventAccessor;
1190
}
1191
1192
/**
1193
* Set an accessor object for the javax.swing.ClientPropertyKey class.
1194
*/
1195
public static void setClientPropertyKeyAccessor(ClientPropertyKeyAccessor cpka) {
1196
clientPropertyKeyAccessor = cpka;
1197
}
1198
1199
/**
1200
* Retrieve the accessor object for the javax.swing.ClientPropertyKey class.
1201
*/
1202
public static ClientPropertyKeyAccessor getClientPropertyKeyAccessor() {
1203
if (clientPropertyKeyAccessor == null) {
1204
ensureClassInitialized(ClientPropertyKeyAccessor.class);
1205
}
1206
return clientPropertyKeyAccessor;
1207
}
1208
1209
/**
1210
* Set an accessor object for the java.awt.SystemTray class.
1211
*/
1212
public static void setSystemTrayAccessor(SystemTrayAccessor sta) {
1213
systemTrayAccessor = sta;
1214
}
1215
1216
/**
1217
* Retrieve the accessor object for the java.awt.SystemTray class.
1218
*/
1219
public static SystemTrayAccessor getSystemTrayAccessor() {
1220
if (systemTrayAccessor == null) {
1221
ensureClassInitialized(SystemTrayAccessor.class);
1222
}
1223
return systemTrayAccessor;
1224
}
1225
1226
/**
1227
* Set an accessor object for the java.awt.TrayIcon class.
1228
*/
1229
public static void setTrayIconAccessor(TrayIconAccessor tia) {
1230
trayIconAccessor = tia;
1231
}
1232
1233
/**
1234
* Retrieve the accessor object for the java.awt.TrayIcon class.
1235
*/
1236
public static TrayIconAccessor getTrayIconAccessor() {
1237
if (trayIconAccessor == null) {
1238
ensureClassInitialized(TrayIconAccessor.class);
1239
}
1240
return trayIconAccessor;
1241
}
1242
1243
/**
1244
* Set an accessor object for the java.awt.DefaultKeyboardFocusManager class.
1245
*/
1246
public static void setDefaultKeyboardFocusManagerAccessor(DefaultKeyboardFocusManagerAccessor dkfma) {
1247
defaultKeyboardFocusManagerAccessor = dkfma;
1248
}
1249
1250
/**
1251
* Retrieve the accessor object for the java.awt.DefaultKeyboardFocusManager class.
1252
*/
1253
public static DefaultKeyboardFocusManagerAccessor getDefaultKeyboardFocusManagerAccessor() {
1254
if (defaultKeyboardFocusManagerAccessor == null) {
1255
ensureClassInitialized(DefaultKeyboardFocusManagerAccessor.class);
1256
}
1257
return defaultKeyboardFocusManagerAccessor;
1258
}
1259
/*
1260
* Set an accessor object for the java.awt.SequencedEvent class.
1261
*/
1262
public static void setSequencedEventAccessor(SequencedEventAccessor sea) {
1263
sequencedEventAccessor = sea;
1264
}
1265
1266
/*
1267
* Get the accessor object for the java.awt.SequencedEvent class.
1268
*/
1269
public static SequencedEventAccessor getSequencedEventAccessor() {
1270
if (sequencedEventAccessor == null) {
1271
try {
1272
ensureClassInitialized(
1273
Class.forName("java.awt.SequencedEvent"));
1274
} catch (ClassNotFoundException ignore) {
1275
}
1276
}
1277
return sequencedEventAccessor;
1278
}
1279
1280
/*
1281
* Set an accessor object for the java.awt.Toolkit class.
1282
*/
1283
public static void setToolkitAccessor(ToolkitAccessor ta) {
1284
toolkitAccessor = ta;
1285
}
1286
1287
/*
1288
* Get the accessor object for the java.awt.Toolkit class.
1289
*/
1290
public static ToolkitAccessor getToolkitAccessor() {
1291
if (toolkitAccessor == null) {
1292
ensureClassInitialized(Toolkit.class);
1293
}
1294
1295
return toolkitAccessor;
1296
}
1297
1298
/*
1299
* Get the accessor object for the java.awt.event.InvocationEvent class.
1300
*/
1301
public static void setInvocationEventAccessor(InvocationEventAccessor invocationEventAccessor) {
1302
AWTAccessor.invocationEventAccessor = invocationEventAccessor;
1303
}
1304
1305
/*
1306
* Set the accessor object for the java.awt.event.InvocationEvent class.
1307
*/
1308
public static InvocationEventAccessor getInvocationEventAccessor() {
1309
return invocationEventAccessor;
1310
}
1311
1312
/*
1313
* Get the accessor object for the java.awt.SystemColor class.
1314
*/
1315
public static SystemColorAccessor getSystemColorAccessor() {
1316
if (systemColorAccessor == null) {
1317
ensureClassInitialized(SystemColor.class);
1318
}
1319
1320
return systemColorAccessor;
1321
}
1322
1323
/*
1324
* Set the accessor object for the java.awt.SystemColor class.
1325
*/
1326
public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
1327
AWTAccessor.systemColorAccessor = systemColorAccessor;
1328
}
1329
1330
/*
1331
* Get the accessor object for the javax.accessibility.AccessibleContext class.
1332
*/
1333
public static AccessibleContextAccessor getAccessibleContextAccessor() {
1334
if (accessibleContextAccessor == null) {
1335
ensureClassInitialized(AccessibleContext.class);
1336
}
1337
return accessibleContextAccessor;
1338
}
1339
1340
/*
1341
* Set the accessor object for the javax.accessibility.AccessibleBundle class.
1342
*/
1343
public static void setAccessibleBundleAccessor(AccessibleBundleAccessor accessor) {
1344
AWTAccessor.accessibleBundleAccessor = accessor;
1345
}
1346
1347
/*
1348
* Get the accessor object for the javax.accessibility.AccessibleBundle class.
1349
*/
1350
public static AccessibleBundleAccessor getAccessibleBundleAccessor() {
1351
if (accessibleBundleAccessor == null) {
1352
ensureClassInitialized(AccessibleBundle.class);
1353
}
1354
return accessibleBundleAccessor;
1355
}
1356
1357
/*
1358
* Set the accessor object for the javax.accessibility.AccessibleContext class.
1359
*/
1360
public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) {
1361
AWTAccessor.accessibleContextAccessor = accessor;
1362
}
1363
1364
/*
1365
* Get the accessor object for the java.awt.dnd.DragSourceContext class.
1366
*/
1367
public static DragSourceContextAccessor getDragSourceContextAccessor() {
1368
if (dragSourceContextAccessor == null) {
1369
ensureClassInitialized(DragSourceContext.class);
1370
}
1371
return dragSourceContextAccessor;
1372
}
1373
1374
/*
1375
* Set the accessor object for the java.awt.dnd.DragSourceContext class.
1376
*/
1377
public static void setDragSourceContextAccessor(DragSourceContextAccessor accessor) {
1378
AWTAccessor.dragSourceContextAccessor = accessor;
1379
}
1380
1381
/*
1382
* Get the accessor object for the java.awt.dnd.DropTargetContext class.
1383
*/
1384
public static DropTargetContextAccessor getDropTargetContextAccessor() {
1385
if (dropTargetContextAccessor == null) {
1386
ensureClassInitialized(DropTargetContext.class);
1387
}
1388
return dropTargetContextAccessor;
1389
}
1390
1391
/*
1392
* Set the accessor object for the java.awt.dnd.DropTargetContext class.
1393
*/
1394
public static void setDropTargetContextAccessor(DropTargetContextAccessor accessor) {
1395
AWTAccessor.dropTargetContextAccessor = accessor;
1396
}
1397
1398
private static void ensureClassInitialized(Class<?> c) {
1399
try {
1400
MethodHandles.lookup().ensureInitialized(c);
1401
} catch (IllegalAccessException e) {}
1402
}
1403
}
1404
1405