1 /* 2 * Copyright (c) 2008, 2011, 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 java.awt.*; 29 import java.awt.KeyboardFocusManager; 30 import java.awt.DefaultKeyboardFocusManager; 31 import java.awt.event.InputEvent; 32 import java.awt.event.KeyEvent; 33 import java.awt.geom.Point2D; 34 35 import sun.misc.Unsafe; 36 import java.awt.peer.ComponentPeer; 37 38 import java.security.AccessControlContext; 39 40 import java.io.File; 41 import java.util.Vector; 42 43 /** 44 * The AWTAccessor utility class. 45 * The main purpose of this class is to enable accessing 46 * private and package-private fields of classes from 47 * different classes/packages. See sun.misc.SharedSecretes 48 * for another example. 49 */ 50 public final class AWTAccessor { 51 52 private static final Unsafe unsafe = Unsafe.getUnsafe(); 53 54 /* 55 * We don't need any objects of this class. 56 * It's rather a collection of static methods 57 * and interfaces. 58 */ 59 private AWTAccessor() { 60 } 61 62 /* 63 * An interface of accessor for the java.awt.Component class. 64 */ 65 public interface ComponentAccessor { 66 /* 67 * Sets whether the native background erase for a component 68 * has been disabled via SunToolkit.disableBackgroundErase(). 69 */ 70 void setBackgroundEraseDisabled(Component comp, boolean disabled); 71 /* 72 * Indicates whether the native background erase for a 73 * component has been disabled via 74 * SunToolkit.disableBackgroundErase(). 75 */ 76 boolean getBackgroundEraseDisabled(Component comp); 77 /* 78 * 79 * Gets the bounds of this component in the form of a 80 * <code>Rectangle</code> object. The bounds specify this 81 * component's width, height, and location relative to 82 * its parent. 83 */ 84 Rectangle getBounds(Component comp); 85 /* 86 * Sets the shape of a lw component to cut out from hw components. 87 * 88 * See 6797587, 6776743, 6768307, and 6768332 for details 89 */ 90 void setMixingCutoutShape(Component comp, Shape shape); 91 92 /** 93 * Sets GraphicsConfiguration value for the component. 94 */ 95 void setGraphicsConfiguration(Component comp, GraphicsConfiguration gc); 96 /* 97 * Requests focus to the component. 98 */ 99 boolean requestFocus(Component comp, CausedFocusEvent.Cause cause); 100 /* 101 * Determines if the component can gain focus. 102 */ 103 boolean canBeFocusOwner(Component comp); 104 105 /** 106 * Returns whether the component is visible without invoking 107 * any client code. 108 */ 109 boolean isVisible(Component comp); 110 111 /** 112 * Sets the RequestFocusController. 113 */ 114 void setRequestFocusController(RequestFocusController requestController); 115 116 /** 117 * Returns the appContext of the component. 118 */ 119 AppContext getAppContext(Component comp); 120 121 /** 122 * Sets the appContext of the component. 123 */ 124 void setAppContext(Component comp, AppContext appContext); 125 126 /** 127 * Returns the parent of the component. 128 */ 129 Container getParent(Component comp); 130 131 /** 132 * Sets the parent of the component to the specified parent. 133 */ 134 void setParent(Component comp, Container parent); 135 136 /** 137 * Resizes the component to the specified width and height. 138 */ 139 void setSize(Component comp, int width, int height); 140 141 /** 142 * Returns the location of the component. 143 */ 144 Point getLocation(Component comp); 145 146 /** 147 * Moves the component to the new location. 148 */ 149 void setLocation(Component comp, int x, int y); 150 151 /** 152 * Determines whether this component is enabled. 153 */ 154 boolean isEnabled(Component comp); 155 156 /** 157 * Determines whether this component is displayable. 158 */ 159 boolean isDisplayable(Component comp); 160 161 /** 162 * Gets the cursor set in the component. 163 */ 164 Cursor getCursor(Component comp); 165 166 /** 167 * Returns the peer of the component. 168 */ 169 ComponentPeer getPeer(Component comp); 170 171 /** 172 * Sets the peer of the component to the specified peer. 173 */ 174 void setPeer(Component comp, ComponentPeer peer); 175 176 /** 177 * Determines whether this component is lightweight. 178 */ 179 boolean isLightweight(Component comp); 180 181 /** 182 * Returns whether or not paint messages received from 183 * the operating system should be ignored. 184 */ 185 boolean getIgnoreRepaint(Component comp); 186 187 /** 188 * Returns the width of the component. 189 */ 190 int getWidth(Component comp); 191 192 /** 193 * Returns the height of the component. 194 */ 195 int getHeight(Component comp); 196 197 /** 198 * Returns the x coordinate of the component. 199 */ 200 int getX(Component comp); 201 202 /** 203 * Returns the y coordinate of the component. 204 */ 205 int getY(Component comp); 206 207 /** 208 * Gets the foreground color of this component. 209 */ 210 Color getForeground(Component comp); 211 212 /** 213 * Gets the background color of this component. 214 */ 215 Color getBackground(Component comp); 216 217 /** 218 * Sets the background of this component to the specified color. 219 */ 220 void setBackground(Component comp, Color background); 221 222 /** 223 * Gets the font of the component. 224 */ 225 Font getFont(Component comp); 226 227 /** 228 * Processes events occurring on this component. 229 */ 230 void processEvent(Component comp, AWTEvent e); 231 232 233 /* 234 * Returns the acc this component was constructed with. 235 */ 236 AccessControlContext getAccessControlContext(Component comp); 237 238 } 239 240 /* 241 * An interface of accessor for the java.awt.Container class. 242 */ 243 public interface ContainerAccessor { 244 /** 245 * Validates the container unconditionally. 246 */ 247 void validateUnconditionally(Container cont); 248 } 249 250 /* 251 * An interface of accessor for java.awt.Window class. 252 */ 253 public interface WindowAccessor { 254 /* 255 * Get opacity level of the given window. 256 */ 257 float getOpacity(Window window); 258 /* 259 * Set opacity level to the given window. 260 */ 261 void setOpacity(Window window, float opacity); 262 /* 263 * Get a shape assigned to the given window. 264 */ 265 Shape getShape(Window window); 266 /* 267 * Set a shape to the given window. 268 */ 269 void setShape(Window window, Shape shape); 270 /* 271 * Set the opaque preoperty to the given window. 272 */ 273 void setOpaque(Window window, boolean isOpaque); 274 /* 275 * Update the image of a non-opaque (translucent) window. 276 */ 277 void updateWindow(Window window); 278 279 /** Get the size of the security warning. 280 */ 281 Dimension getSecurityWarningSize(Window w); 282 283 /** 284 * Set the size of the security warning. 285 */ 286 void setSecurityWarningSize(Window w, int width, int height); 287 288 /** Set the position of the security warning. 289 */ 290 void setSecurityWarningPosition(Window w, Point2D point, 291 float alignmentX, float alignmentY); 292 293 /** Request to recalculate the new position of the security warning for 294 * the given window size/location as reported by the native system. 295 */ 296 Point2D calculateSecurityWarningPosition(Window window, 297 double x, double y, double w, double h); 298 299 /** Sets the synchronous status of focus requests on lightweight 300 * components in the specified window to the specified value. 301 */ 302 void setLWRequestStatus(Window changed, boolean status); 303 304 /** 305 * Indicates whether this window should receive focus on subsequently 306 * being shown, or being moved to the front. 307 */ 308 boolean isAutoRequestFocus(Window w); 309 310 /** 311 * Indicates whether the specified window is an utility window for TrayIcon. 312 */ 313 boolean isTrayIconWindow(Window w); 314 315 /** 316 * Marks the specified window as an utility window for TrayIcon. 317 */ 318 void setTrayIconWindow(Window w, boolean isTrayIconWindow); 319 } 320 321 /** 322 * An accessor for the AWTEvent class. 323 */ 324 public interface AWTEventAccessor { 325 /** 326 * Marks the event as posted. 327 */ 328 void setPosted(AWTEvent ev); 329 330 /** 331 * Sets the flag on this AWTEvent indicating that it was 332 * generated by the system. 333 */ 334 void setSystemGenerated(AWTEvent ev); 335 336 /** 337 * Indicates whether this AWTEvent was generated by the system. 338 */ 339 boolean isSystemGenerated(AWTEvent ev); 340 341 /** 342 * Returns the acc this event was constructed with. 343 */ 344 AccessControlContext getAccessControlContext(AWTEvent ev); 345 346 /** 347 * Returns binary data associated with this event; 348 */ 349 byte[] getBData(AWTEvent ev); 350 351 /** 352 * Associates binary data with this event; 353 */ 354 void setBData(AWTEvent ev, byte[] bdata); 355 } 356 357 public interface InputEventAccessor { 358 /* 359 * Accessor for InputEvent.getButtonDownMasks() 360 */ 361 int[] getButtonDownMasks(); 362 } 363 364 /* 365 * An accessor for the java.awt.Frame class. 366 */ 367 public interface FrameAccessor { 368 /* 369 * Sets the state of this frame. 370 */ 371 void setExtendedState(Frame frame, int state); 372 /* 373 * Gets the state of this frame. 374 */ 375 int getExtendedState(Frame frame); 376 /* 377 * Gets the maximized bounds of this frame. 378 */ 379 Rectangle getMaximizedBounds(Frame frame); 380 } 381 382 /** 383 * An interface of accessor for the java.awt.KeyboardFocusManager class. 384 */ 385 public interface KeyboardFocusManagerAccessor { 386 /** 387 * Indicates whether the native implementation should 388 * proceed with a pending focus request for the heavyweight. 389 */ 390 int shouldNativelyFocusHeavyweight(Component heavyweight, 391 Component descendant, 392 boolean temporary, 393 boolean focusedWindowChangeAllowed, 394 long time, 395 CausedFocusEvent.Cause cause); 396 /** 397 * Delivers focus for the lightweight descendant of the heavyweight 398 * synchronously. 399 */ 400 boolean processSynchronousLightweightTransfer(Component heavyweight, 401 Component descendant, 402 boolean temporary, 403 boolean focusedWindowChangeAllowed, 404 long time); 405 /** 406 * Removes the last focus request for the heavyweight from the queue. 407 */ 408 void removeLastFocusRequest(Component heavyweight); 409 410 /** 411 * Sets the most recent focus owner in the window. 412 */ 413 void setMostRecentFocusOwner(Window window, Component component); 414 415 /** 416 * Returns current KFM of the specified AppContext. 417 */ 418 KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx); 419 420 /** 421 * Return the current focus cycle root 422 */ 423 Container getCurrentFocusCycleRoot(); 424 } 425 426 /** 427 * An accessor for the MenuComponent class. 428 */ 429 public interface MenuComponentAccessor { 430 /** 431 * Returns the appContext of the menu component. 432 */ 433 AppContext getAppContext(MenuComponent menuComp); 434 435 /** 436 * Sets the appContext of the menu component. 437 */ 438 void setAppContext(MenuComponent menuComp, AppContext appContext); 439 440 /** 441 * Returns the menu container of the menu component 442 */ 443 MenuContainer getParent(MenuComponent menuComp); 444 445 /** 446 * Gets the font used for this menu component. 447 */ 448 Font getFont_NoClientCode(MenuComponent menuComp); 449 } 450 451 /** 452 * An accessor for the EventQueue class 453 */ 454 public interface EventQueueAccessor { 455 /** 456 * Gets the event dispatch thread. 457 */ 458 Thread getDispatchThread(EventQueue eventQueue); 459 460 /** 461 * Checks if the current thread is EDT for the given EQ. 462 */ 463 public boolean isDispatchThreadImpl(EventQueue eventQueue); 464 465 /** 466 * Removes any pending events for the specified source object. 467 */ 468 void removeSourceEvents(EventQueue eventQueue, Object source, boolean removeAllEvents); 469 470 /** 471 * Returns whether an event is pending on any of the separate Queues. 472 */ 473 boolean noEvents(EventQueue eventQueue); 474 475 /** 476 * Called from PostEventQueue.postEvent to notify that a new event 477 * appeared. 478 */ 479 void wakeup(EventQueue eventQueue, boolean isShutdown); 480 } 481 482 /* 483 * An accessor for the PopupMenu class 484 */ 485 public interface PopupMenuAccessor { 486 /* 487 * Returns whether the popup menu is attached to a tray 488 */ 489 boolean isTrayIconPopup(PopupMenu popupMenu); 490 } 491 492 /* 493 * An accessor for the FileDialog class 494 */ 495 public interface FileDialogAccessor { 496 /* 497 * Sets the files the user selects 498 */ 499 void setFiles(FileDialog fileDialog, File files[]); 500 501 /* 502 * Sets the file the user selects 503 */ 504 void setFile(FileDialog fileDialog, String file); 505 506 /* 507 * Sets the directory the user selects 508 */ 509 void setDirectory(FileDialog fileDialog, String directory); 510 511 /* 512 * Returns whether the file dialog allows the multiple file selection. 513 */ 514 boolean isMultipleMode(FileDialog fileDialog); 515 } 516 517 /** 518 * An accessor for the ScrollPaneAdjustable class. 519 */ 520 public interface ScrollPaneAdjustableAccessor { 521 /** 522 * Sets the value of this scrollbar to the specified value. 523 */ 524 void setTypedValue(final ScrollPaneAdjustable adj, final int v, 525 final int type); 526 } 527 528 /** 529 * An accessor for the CheckboxMenuItem class 530 */ 531 public interface CheckboxMenuItemAccessor { 532 /** 533 * Returns whether menu item is checked 534 */ 535 boolean getState(CheckboxMenuItem cmi); 536 } 537 538 /** 539 * An accessor for the Cursor class 540 */ 541 public interface CursorAccessor { 542 /** 543 * Returns pData of the Cursor class 544 */ 545 long getPData(Cursor cursor); 546 547 /** 548 * Sets pData to the Cursor class 549 */ 550 void setPData(Cursor cursor, long pData); 551 552 /** 553 * Return type of the Cursor class 554 */ 555 int getType(Cursor cursor); 556 } 557 558 /** 559 * An accessor for the MenuBar class 560 */ 561 public interface MenuBarAccessor { 562 /** 563 * Returns help menu 564 */ 565 Menu getHelpMenu(MenuBar menuBar); 566 567 /** 568 * Returns menus 569 */ 570 Vector getMenus(MenuBar menuBar); 571 } 572 573 /** 574 * An accessor for the MenuItem class 575 */ 576 public interface MenuItemAccessor { 577 /** 578 * Returns whether menu item is enabled 579 */ 580 boolean isEnabled(MenuItem item); 581 582 /** 583 * Gets the command name of the action event that is fired 584 * by this menu item. 585 */ 586 String getActionCommandImpl(MenuItem item); 587 588 /** 589 * Returns true if the item and all its ancestors are 590 * enabled, false otherwise 591 */ 592 boolean isItemEnabled(MenuItem item); 593 594 /** 595 * Returns label 596 */ 597 String getLabel(MenuItem item); 598 599 /** 600 * Returns shortcut 601 */ 602 MenuShortcut getShortcut(MenuItem item); 603 } 604 605 /** 606 * An accessor for the Menu class 607 */ 608 public interface MenuAccessor { 609 /** 610 * Returns vector of the items that are part of the Menu 611 */ 612 Vector getItems(Menu menu); 613 } 614 615 /** 616 * An accessor for the KeyEvent class 617 */ 618 public interface KeyEventAccessor { 619 /** 620 * Sets rawCode field for KeyEvent 621 */ 622 void setRawCode(KeyEvent ev, long rawCode); 623 624 /** 625 * Sets primaryLevelUnicode field for KeyEvent 626 */ 627 void setPrimaryLevelUnicode(KeyEvent ev, long primaryLevelUnicode); 628 629 /** 630 * Sets extendedKeyCode field for KeyEvent 631 */ 632 void setExtendedKeyCode(KeyEvent ev, long extendedKeyCode); 633 } 634 635 /** 636 * An accessor for the ClientPropertyKey class 637 */ 638 public interface ClientPropertyKeyAccessor { 639 /** 640 * Retrieves JComponent_TRANSFER_HANDLER enum object 641 */ 642 Object getJComponent_TRANSFER_HANDLER(); 643 } 644 645 /** 646 * An accessor for the SystemTray class 647 */ 648 public interface SystemTrayAccessor { 649 /** 650 * Support for reporting bound property changes for Object properties. 651 */ 652 void firePropertyChange(SystemTray tray, String propertyName, Object oldValue, Object newValue); 653 } 654 655 /** 656 * An accessor for the TrayIcon class 657 */ 658 public interface TrayIconAccessor { 659 void addNotify(TrayIcon trayIcon) throws AWTException; 660 void removeNotify(TrayIcon trayIcon); 661 } 662 663 /** 664 * An accessor for the DefaultKeyboardFocusManager class 665 */ 666 public interface DefaultKeyboardFocusManagerAccessor { 667 public void consumeNextKeyTyped(DefaultKeyboardFocusManager dkfm, KeyEvent e); 668 } 669 670 /* 671 * Accessor instances are initialized in the static initializers of 672 * corresponding AWT classes by using setters defined below. 673 */ 674 private static ComponentAccessor componentAccessor; 675 private static ContainerAccessor containerAccessor; 676 private static WindowAccessor windowAccessor; 677 private static AWTEventAccessor awtEventAccessor; 678 private static InputEventAccessor inputEventAccessor; 679 private static FrameAccessor frameAccessor; 680 private static KeyboardFocusManagerAccessor kfmAccessor; 681 private static MenuComponentAccessor menuComponentAccessor; 682 private static EventQueueAccessor eventQueueAccessor; 683 private static PopupMenuAccessor popupMenuAccessor; 684 private static FileDialogAccessor fileDialogAccessor; 685 private static ScrollPaneAdjustableAccessor scrollPaneAdjustableAccessor; 686 private static CheckboxMenuItemAccessor checkboxMenuItemAccessor; 687 private static CursorAccessor cursorAccessor; 688 private static MenuBarAccessor menuBarAccessor; 689 private static MenuItemAccessor menuItemAccessor; 690 private static MenuAccessor menuAccessor; 691 private static KeyEventAccessor keyEventAccessor; 692 private static ClientPropertyKeyAccessor clientPropertyKeyAccessor; 693 private static SystemTrayAccessor systemTrayAccessor; 694 private static TrayIconAccessor trayIconAccessor; 695 private static DefaultKeyboardFocusManagerAccessor defaultKeyboardFocusManagerAccessor; 696 697 /* 698 * Set an accessor object for the java.awt.Component class. 699 */ 700 public static void setComponentAccessor(ComponentAccessor ca) { 701 componentAccessor = ca; 702 } 703 704 /* 705 * Retrieve the accessor object for the java.awt.Component class. 706 */ 707 public static ComponentAccessor getComponentAccessor() { 708 if (componentAccessor == null) { 709 unsafe.ensureClassInitialized(Component.class); 710 } 711 712 return componentAccessor; 713 } 714 715 /* 716 * Set an accessor object for the java.awt.Container class. 717 */ 718 public static void setContainerAccessor(ContainerAccessor ca) { 719 containerAccessor = ca; 720 } 721 722 /* 723 * Retrieve the accessor object for the java.awt.Container class. 724 */ 725 public static ContainerAccessor getContainerAccessor() { 726 if (containerAccessor == null) { 727 unsafe.ensureClassInitialized(Container.class); 728 } 729 730 return containerAccessor; 731 } 732 733 /* 734 * Set an accessor object for the java.awt.Window class. 735 */ 736 public static void setWindowAccessor(WindowAccessor wa) { 737 windowAccessor = wa; 738 } 739 740 /* 741 * Retrieve the accessor object for the java.awt.Window class. 742 */ 743 public static WindowAccessor getWindowAccessor() { 744 if (windowAccessor == null) { 745 unsafe.ensureClassInitialized(Window.class); 746 } 747 return windowAccessor; 748 } 749 750 /* 751 * Set an accessor object for the java.awt.AWTEvent class. 752 */ 753 public static void setAWTEventAccessor(AWTEventAccessor aea) { 754 awtEventAccessor = aea; 755 } 756 757 /* 758 * Retrieve the accessor object for the java.awt.AWTEvent class. 759 */ 760 public static AWTEventAccessor getAWTEventAccessor() { 761 if (awtEventAccessor == null) { 762 unsafe.ensureClassInitialized(AWTEvent.class); 763 } 764 return awtEventAccessor; 765 } 766 767 /* 768 * Set an accessor object for the java.awt.event.InputEvent class. 769 */ 770 public static void setInputEventAccessor(InputEventAccessor iea) { 771 inputEventAccessor = iea; 772 } 773 774 /* 775 * Retrieve the accessor object for the java.awt.event.InputEvent class. 776 */ 777 public static InputEventAccessor getInputEventAccessor() { 778 if (inputEventAccessor == null) { 779 unsafe.ensureClassInitialized(InputEvent.class); 780 } 781 return inputEventAccessor; 782 } 783 784 /* 785 * Set an accessor object for the java.awt.Frame class. 786 */ 787 public static void setFrameAccessor(FrameAccessor fa) { 788 frameAccessor = fa; 789 } 790 791 /* 792 * Retrieve the accessor object for the java.awt.Frame class. 793 */ 794 public static FrameAccessor getFrameAccessor() { 795 if (frameAccessor == null) { 796 unsafe.ensureClassInitialized(Frame.class); 797 } 798 return frameAccessor; 799 } 800 801 /* 802 * Set an accessor object for the java.awt.KeyboardFocusManager class. 803 */ 804 public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) { 805 kfmAccessor = kfma; 806 } 807 808 /* 809 * Retrieve the accessor object for the java.awt.KeyboardFocusManager class. 810 */ 811 public static KeyboardFocusManagerAccessor getKeyboardFocusManagerAccessor() { 812 if (kfmAccessor == null) { 813 unsafe.ensureClassInitialized(KeyboardFocusManager.class); 814 } 815 return kfmAccessor; 816 } 817 818 /* 819 * Set an accessor object for the java.awt.MenuComponent class. 820 */ 821 public static void setMenuComponentAccessor(MenuComponentAccessor mca) { 822 menuComponentAccessor = mca; 823 } 824 825 /* 826 * Retrieve the accessor object for the java.awt.MenuComponent class. 827 */ 828 public static MenuComponentAccessor getMenuComponentAccessor() { 829 if (menuComponentAccessor == null) { 830 unsafe.ensureClassInitialized(MenuComponent.class); 831 } 832 return menuComponentAccessor; 833 } 834 835 /* 836 * Set an accessor object for the java.awt.EventQueue class. 837 */ 838 public static void setEventQueueAccessor(EventQueueAccessor eqa) { 839 eventQueueAccessor = eqa; 840 } 841 842 /* 843 * Retrieve the accessor object for the java.awt.EventQueue class. 844 */ 845 public static EventQueueAccessor getEventQueueAccessor() { 846 if (eventQueueAccessor == null) { 847 unsafe.ensureClassInitialized(EventQueue.class); 848 } 849 return eventQueueAccessor; 850 } 851 852 /* 853 * Set an accessor object for the java.awt.PopupMenu class. 854 */ 855 public static void setPopupMenuAccessor(PopupMenuAccessor pma) { 856 popupMenuAccessor = pma; 857 } 858 859 /* 860 * Retrieve the accessor object for the java.awt.PopupMenu class. 861 */ 862 public static PopupMenuAccessor getPopupMenuAccessor() { 863 if (popupMenuAccessor == null) { 864 unsafe.ensureClassInitialized(PopupMenu.class); 865 } 866 return popupMenuAccessor; 867 } 868 869 /* 870 * Set an accessor object for the java.awt.FileDialog class. 871 */ 872 public static void setFileDialogAccessor(FileDialogAccessor fda) { 873 fileDialogAccessor = fda; 874 } 875 876 /* 877 * Retrieve the accessor object for the java.awt.FileDialog class. 878 */ 879 public static FileDialogAccessor getFileDialogAccessor() { 880 if (fileDialogAccessor == null) { 881 unsafe.ensureClassInitialized(FileDialog.class); 882 } 883 return fileDialogAccessor; 884 } 885 886 /** 887 * Set an accessor object for the java.awt.ScrollPaneAdjustable class. 888 */ 889 public static void setScrollPaneAdjustableAccessor(ScrollPaneAdjustableAccessor adj) { 890 scrollPaneAdjustableAccessor = adj; 891 } 892 893 /** 894 * Retrieve the accessor object for the java.awt.ScrollPaneAdjustable 895 * class. 896 */ 897 public static ScrollPaneAdjustableAccessor getScrollPaneAdjustableAccessor() { 898 if (scrollPaneAdjustableAccessor == null) { 899 unsafe.ensureClassInitialized(ScrollPaneAdjustable.class); 900 } 901 return scrollPaneAdjustableAccessor; 902 } 903 904 /** 905 * Set an accessor object for the java.awt.CheckboxMenuItem class. 906 */ 907 public static void setCheckboxMenuItemAccessor(CheckboxMenuItemAccessor cmia) { 908 checkboxMenuItemAccessor = cmia; 909 } 910 911 /** 912 * Retrieve the accessor object for the java.awt.CheckboxMenuItem class. 913 */ 914 public static CheckboxMenuItemAccessor getCheckboxMenuItemAccessor() { 915 if (checkboxMenuItemAccessor == null) { 916 unsafe.ensureClassInitialized(CheckboxMenuItemAccessor.class); 917 } 918 return checkboxMenuItemAccessor; 919 } 920 921 /** 922 * Set an accessor object for the java.awt.Cursor class. 923 */ 924 public static void setCursorAccessor(CursorAccessor ca) { 925 cursorAccessor = ca; 926 } 927 928 /** 929 * Retrieve the accessor object for the java.awt.Cursor class. 930 */ 931 public static CursorAccessor getCursorAccessor() { 932 if (cursorAccessor == null) { 933 unsafe.ensureClassInitialized(CursorAccessor.class); 934 } 935 return cursorAccessor; 936 } 937 938 /** 939 * Set an accessor object for the java.awt.MenuBar class. 940 */ 941 public static void setMenuBarAccessor(MenuBarAccessor mba) { 942 menuBarAccessor = mba; 943 } 944 945 /** 946 * Retrieve the accessor object for the java.awt.MenuBar class. 947 */ 948 public static MenuBarAccessor getMenuBarAccessor() { 949 if (menuBarAccessor == null) { 950 unsafe.ensureClassInitialized(MenuBarAccessor.class); 951 } 952 return menuBarAccessor; 953 } 954 955 /** 956 * Set an accessor object for the java.awt.MenuItem class. 957 */ 958 public static void setMenuItemAccessor(MenuItemAccessor mia) { 959 menuItemAccessor = mia; 960 } 961 962 /** 963 * Retrieve the accessor object for the java.awt.MenuItem class. 964 */ 965 public static MenuItemAccessor getMenuItemAccessor() { 966 if (menuItemAccessor == null) { 967 unsafe.ensureClassInitialized(MenuItemAccessor.class); 968 } 969 return menuItemAccessor; 970 } 971 972 /** 973 * Set an accessor object for the java.awt.Menu class. 974 */ 975 public static void setMenuAccessor(MenuAccessor ma) { 976 menuAccessor = ma; 977 } 978 979 /** 980 * Retrieve the accessor object for the java.awt.Menu class. 981 */ 982 public static MenuAccessor getMenuAccessor() { 983 if (menuAccessor == null) { 984 unsafe.ensureClassInitialized(MenuAccessor.class); 985 } 986 return menuAccessor; 987 } 988 989 /** 990 * Set an accessor object for the java.awt.event.KeyEvent class. 991 */ 992 public static void setKeyEventAccessor(KeyEventAccessor kea) { 993 keyEventAccessor = kea; 994 } 995 996 /** 997 * Retrieve the accessor object for the java.awt.event.KeyEvent class. 998 */ 999 public static KeyEventAccessor getKeyEventAccessor() { 1000 if (keyEventAccessor == null) { 1001 unsafe.ensureClassInitialized(KeyEventAccessor.class); 1002 } 1003 return keyEventAccessor; 1004 } 1005 1006 /** 1007 * Set an accessor object for the javax.swing.ClientPropertyKey class. 1008 */ 1009 public static void setClientPropertyKeyAccessor(ClientPropertyKeyAccessor cpka) { 1010 clientPropertyKeyAccessor = cpka; 1011 } 1012 1013 /** 1014 * Retrieve the accessor object for the javax.swing.ClientPropertyKey class. 1015 */ 1016 public static ClientPropertyKeyAccessor getClientPropertyKeyAccessor() { 1017 if (clientPropertyKeyAccessor == null) { 1018 unsafe.ensureClassInitialized(ClientPropertyKeyAccessor.class); 1019 } 1020 return clientPropertyKeyAccessor; 1021 } 1022 1023 /** 1024 * Set an accessor object for the java.awt.SystemTray class. 1025 */ 1026 public static void setSystemTrayAccessor(SystemTrayAccessor sta) { 1027 systemTrayAccessor = sta; 1028 } 1029 1030 /** 1031 * Retrieve the accessor object for the java.awt.SystemTray class. 1032 */ 1033 public static SystemTrayAccessor getSystemTrayAccessor() { 1034 if (systemTrayAccessor == null) { 1035 unsafe.ensureClassInitialized(SystemTrayAccessor.class); 1036 } 1037 return systemTrayAccessor; 1038 } 1039 1040 /** 1041 * Set an accessor object for the java.awt.TrayIcon class. 1042 */ 1043 public static void setTrayIconAccessor(TrayIconAccessor tia) { 1044 trayIconAccessor = tia; 1045 } 1046 1047 /** 1048 * Retrieve the accessor object for the java.awt.TrayIcon class. 1049 */ 1050 public static TrayIconAccessor getTrayIconAccessor() { 1051 if (trayIconAccessor == null) { 1052 unsafe.ensureClassInitialized(TrayIconAccessor.class); 1053 } 1054 return trayIconAccessor; 1055 } 1056 1057 /** 1058 * Set an accessor object for the java.awt.DefaultKeyboardFocusManager class. 1059 */ 1060 public static void setDefaultKeyboardFocusManagerAccessor(DefaultKeyboardFocusManagerAccessor dkfma) { 1061 defaultKeyboardFocusManagerAccessor = dkfma; 1062 } 1063 1064 /** 1065 * Retrieve the accessor object for the java.awt.DefaultKeyboardFocusManager class. 1066 */ 1067 public static DefaultKeyboardFocusManagerAccessor getDefaultKeyboardFocusManagerAccessor() { 1068 if (defaultKeyboardFocusManagerAccessor == null) { 1069 unsafe.ensureClassInitialized(DefaultKeyboardFocusManagerAccessor.class); 1070 } 1071 return defaultKeyboardFocusManagerAccessor; 1072 } 1073 1074 }