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 jdk.internal.misc.Unsafe;
29
30 import javax.accessibility.AccessibleContext;
31 import java.awt.*;
32 import java.awt.event.FocusEvent.Cause;
33 import java.awt.dnd.DragSourceContext;
34 import java.awt.dnd.DropTargetContext;
35 import java.awt.dnd.peer.DragSourceContextPeer;
36 import java.awt.dnd.peer.DropTargetContextPeer;
37 import java.awt.event.AWTEventListener;
38 import java.awt.event.InputEvent;
39 import java.awt.event.InvocationEvent;
40 import java.awt.event.KeyEvent;
41 import java.awt.geom.Point2D;
42 import java.awt.image.BufferStrategy;
43 import java.awt.peer.ComponentPeer;
44
45 import java.awt.peer.MenuComponentPeer;
46 import java.lang.reflect.InvocationTargetException;
47 import java.security.AccessControlContext;
48
49 import java.io.File;
50 import java.util.ResourceBundle;
51 import java.util.Vector;
52 import javax.accessibility.AccessibleBundle;
53
54 /**
55 * The AWTAccessor utility class.
56 * The main purpose of this class is to enable accessing
57 * private and package-private fields of classes from
58 * different classes/packages. See sun.misc.SharedSecretes
59 * for another example.
60 */
395 /**
396 * Associates binary data with this event;
397 */
398 void setBData(AWTEvent ev, byte[] bdata);
399 }
400
401 public interface InputEventAccessor {
402 /*
403 * Accessor for InputEvent.getButtonDownMasks()
404 */
405 int[] getButtonDownMasks();
406
407 /*
408 * Accessor for InputEvent.canAccessSystemClipboard field
409 */
410 boolean canAccessSystemClipboard(InputEvent event);
411 void setCanAccessSystemClipboard(InputEvent event,
412 boolean canAccessSystemClipboard);
413 }
414
415 /*
416 * An accessor for the java.awt.Frame class.
417 */
418 public interface FrameAccessor {
419 /*
420 * Sets the state of this frame.
421 */
422 void setExtendedState(Frame frame, int state);
423 /*
424 * Gets the state of this frame.
425 */
426 int getExtendedState(Frame frame);
427 /*
428 * Gets the maximized bounds of this frame.
429 */
430 Rectangle getMaximizedBounds(Frame frame);
431 }
432
433 /**
434 * An interface of accessor for the java.awt.KeyboardFocusManager class.
834 /**
835 * Resets the DropTargetContext.
836 */
837 void reset(DropTargetContext dtc);
838 /**
839 * Sets the {@code DropTargetContextPeer}
840 */
841 void setDropTargetContextPeer(DropTargetContext dtc,
842 DropTargetContextPeer dtcp);
843 }
844
845 /*
846 * Accessor instances are initialized in the static initializers of
847 * corresponding AWT classes by using setters defined below.
848 */
849 private static ComponentAccessor componentAccessor;
850 private static ContainerAccessor containerAccessor;
851 private static WindowAccessor windowAccessor;
852 private static AWTEventAccessor awtEventAccessor;
853 private static InputEventAccessor inputEventAccessor;
854 private static FrameAccessor frameAccessor;
855 private static KeyboardFocusManagerAccessor kfmAccessor;
856 private static MenuComponentAccessor menuComponentAccessor;
857 private static EventQueueAccessor eventQueueAccessor;
858 private static PopupMenuAccessor popupMenuAccessor;
859 private static FileDialogAccessor fileDialogAccessor;
860 private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
861 private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;
862 private static CursorAccessor cursorAccessor;
863 private static MenuBarAccessor menuBarAccessor;
864 private static MenuItemAccessor menuItemAccessor;
865 private static MenuAccessor menuAccessor;
866 private static KeyEventAccessor keyEventAccessor;
867 private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;
868 private static SystemTrayAccessor systemTrayAccessor;
869 private static TrayIconAccessor trayIconAccessor;
870 private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
871 private static SequencedEventAccessor sequencedEventAccessor;
872 private static ToolkitAccessor toolkitAccessor;
873 private static InvocationEventAccessor invocationEventAccessor;
948 }
949
950 /*
951 * Set an accessor object for the java.awt.event.InputEvent class.
952 */
953 public static void setInputEventAccessor(InputEventAccessor iea) {
954 inputEventAccessor = iea;
955 }
956
957 /*
958 * Retrieve the accessor object for the java.awt.event.InputEvent class.
959 */
960 public static InputEventAccessor getInputEventAccessor() {
961 if (inputEventAccessor == null) {
962 unsafe.ensureClassInitialized(InputEvent.class);
963 }
964 return inputEventAccessor;
965 }
966
967 /*
968 * Set an accessor object for the java.awt.Frame class.
969 */
970 public static void setFrameAccessor(FrameAccessor fa) {
971 frameAccessor = fa;
972 }
973
974 /*
975 * Retrieve the accessor object for the java.awt.Frame class.
976 */
977 public static FrameAccessor getFrameAccessor() {
978 if (frameAccessor == null) {
979 unsafe.ensureClassInitialized(Frame.class);
980 }
981 return frameAccessor;
982 }
983
984 /*
985 * Set an accessor object for the java.awt.KeyboardFocusManager class.
986 */
987 public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {
|
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 jdk.internal.misc.Unsafe;
29
30 import javax.accessibility.AccessibleContext;
31 import java.awt.*;
32 import java.awt.event.FocusEvent.Cause;
33 import java.awt.dnd.DragSourceContext;
34 import java.awt.dnd.DropTargetContext;
35 import java.awt.dnd.peer.DragSourceContextPeer;
36 import java.awt.dnd.peer.DropTargetContextPeer;
37 import java.awt.event.AWTEventListener;
38 import java.awt.event.InputEvent;
39 import java.awt.event.InvocationEvent;
40 import java.awt.event.KeyEvent;
41 import java.awt.event.MouseEvent;
42 import java.awt.geom.Point2D;
43 import java.awt.image.BufferStrategy;
44 import java.awt.peer.ComponentPeer;
45
46 import java.awt.peer.MenuComponentPeer;
47 import java.lang.reflect.InvocationTargetException;
48 import java.security.AccessControlContext;
49
50 import java.io.File;
51 import java.util.ResourceBundle;
52 import java.util.Vector;
53 import javax.accessibility.AccessibleBundle;
54
55 /**
56 * The AWTAccessor utility class.
57 * The main purpose of this class is to enable accessing
58 * private and package-private fields of classes from
59 * different classes/packages. See sun.misc.SharedSecretes
60 * for another example.
61 */
396 /**
397 * Associates binary data with this event;
398 */
399 void setBData(AWTEvent ev, byte[] bdata);
400 }
401
402 public interface InputEventAccessor {
403 /*
404 * Accessor for InputEvent.getButtonDownMasks()
405 */
406 int[] getButtonDownMasks();
407
408 /*
409 * Accessor for InputEvent.canAccessSystemClipboard field
410 */
411 boolean canAccessSystemClipboard(InputEvent event);
412 void setCanAccessSystemClipboard(InputEvent event,
413 boolean canAccessSystemClipboard);
414 }
415
416 /**
417 * An accessor for the MouseEvent class.
418 */
419 public interface MouseEventAccessor {
420 /**
421 * Indicates whether the event is a result of a touch event.
422 */
423 boolean isCausedByTouchEvent(MouseEvent ev);
424
425 /**
426 * Sets whether the event is a result of a touch event.
427 */
428 void setCausedByTouchEvent(MouseEvent ev, boolean causedByTouchEvent);
429 }
430
431 /*
432 * An accessor for the java.awt.Frame class.
433 */
434 public interface FrameAccessor {
435 /*
436 * Sets the state of this frame.
437 */
438 void setExtendedState(Frame frame, int state);
439 /*
440 * Gets the state of this frame.
441 */
442 int getExtendedState(Frame frame);
443 /*
444 * Gets the maximized bounds of this frame.
445 */
446 Rectangle getMaximizedBounds(Frame frame);
447 }
448
449 /**
450 * An interface of accessor for the java.awt.KeyboardFocusManager class.
850 /**
851 * Resets the DropTargetContext.
852 */
853 void reset(DropTargetContext dtc);
854 /**
855 * Sets the {@code DropTargetContextPeer}
856 */
857 void setDropTargetContextPeer(DropTargetContext dtc,
858 DropTargetContextPeer dtcp);
859 }
860
861 /*
862 * Accessor instances are initialized in the static initializers of
863 * corresponding AWT classes by using setters defined below.
864 */
865 private static ComponentAccessor componentAccessor;
866 private static ContainerAccessor containerAccessor;
867 private static WindowAccessor windowAccessor;
868 private static AWTEventAccessor awtEventAccessor;
869 private static InputEventAccessor inputEventAccessor;
870 private static MouseEventAccessor mouseEventAccessor;
871 private static FrameAccessor frameAccessor;
872 private static KeyboardFocusManagerAccessor kfmAccessor;
873 private static MenuComponentAccessor menuComponentAccessor;
874 private static EventQueueAccessor eventQueueAccessor;
875 private static PopupMenuAccessor popupMenuAccessor;
876 private static FileDialogAccessor fileDialogAccessor;
877 private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor;
878 private static CheckboxMenuItemAccessor checkboxMenuItemAccessor;
879 private static CursorAccessor cursorAccessor;
880 private static MenuBarAccessor menuBarAccessor;
881 private static MenuItemAccessor menuItemAccessor;
882 private static MenuAccessor menuAccessor;
883 private static KeyEventAccessor keyEventAccessor;
884 private static ClientPropertyKeyAccessor clientPropertyKeyAccessor;
885 private static SystemTrayAccessor systemTrayAccessor;
886 private static TrayIconAccessor trayIconAccessor;
887 private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor;
888 private static SequencedEventAccessor sequencedEventAccessor;
889 private static ToolkitAccessor toolkitAccessor;
890 private static InvocationEventAccessor invocationEventAccessor;
965 }
966
967 /*
968 * Set an accessor object for the java.awt.event.InputEvent class.
969 */
970 public static void setInputEventAccessor(InputEventAccessor iea) {
971 inputEventAccessor = iea;
972 }
973
974 /*
975 * Retrieve the accessor object for the java.awt.event.InputEvent class.
976 */
977 public static InputEventAccessor getInputEventAccessor() {
978 if (inputEventAccessor == null) {
979 unsafe.ensureClassInitialized(InputEvent.class);
980 }
981 return inputEventAccessor;
982 }
983
984 /*
985 * Set an accessor object for the java.awt.event.MouseEvent class.
986 */
987 public static void setMouseEventAccessor(MouseEventAccessor mea) {
988 mouseEventAccessor = mea;
989 }
990
991 /*
992 * Retrieve the accessor object for the java.awt.event.MouseEvent class.
993 */
994 public static MouseEventAccessor getMouseEventAccessor() {
995 if (mouseEventAccessor == null) {
996 unsafe.ensureClassInitialized(MouseEvent.class);
997 }
998 return mouseEventAccessor;
999 }
1000
1001 /*
1002 * Set an accessor object for the java.awt.Frame class.
1003 */
1004 public static void setFrameAccessor(FrameAccessor fa) {
1005 frameAccessor = fa;
1006 }
1007
1008 /*
1009 * Retrieve the accessor object for the java.awt.Frame class.
1010 */
1011 public static FrameAccessor getFrameAccessor() {
1012 if (frameAccessor == null) {
1013 unsafe.ensureClassInitialized(Frame.class);
1014 }
1015 return frameAccessor;
1016 }
1017
1018 /*
1019 * Set an accessor object for the java.awt.KeyboardFocusManager class.
1020 */
1021 public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {
|