Home » openjdk-7 » sun » awt » [javadoc | source]
abstract public class: SunToolkit [javadoc | source]

All Implemented Interfaces:
    ComponentFactory, InputMethodSupport, WindowClosingListener, WindowClosingSupport, KeyboardFocusManagerPeerProvider

Direct Known Subclasses:
    MToolkit, WToolkit, HToolkit, XToolkit, UNIXToolkit

Nested Class Summary:
static class  SunToolkit.ModalityListenerList   
public static class  SunToolkit.OperationTimedOut   
public static class  SunToolkit.InfiniteLoop   
public static class  SunToolkit.IllegalThreadException   
Field Summary
public static final  int GRAB_EVENT_MASK    Special mask for the UngrabEvent events, in addition to the public masks defined in AWTEvent. Should be used as the mask value for Toolkit.addAWTEventListener. 
protected static  int numberOfButtons    Number of buttons. By default it's taken from the system. If system value does not fit into int type range, use our own MAX_BUTTONS_SUPPORT value. 
public static final  int MAX_BUTTONS_SUPPORTED     
static final  SoftCache imgCache     
public static final  int DEFAULT_WAIT_TIME     
static  Method eqNoEvents     
public static final  String DESKTOPFONTHINTS     
Fields inherited from java.awt.Toolkit:
desktopProperties,  desktopPropsSupport,  $assertionsDisabled
 public SunToolkit() 
Method from sun.awt.SunToolkit Summary:
addModalityListener,   awtLock,   awtLockNotify,   awtLockNotifyAll,   awtLockWait,   awtLockWait,   awtTryLock,   awtUnlock,   checkAndSetPolicy,   checkImage,   closeSplashScreen,   consumeNextKeyTyped,   createButton,   createCanvas,   createCheckbox,   createCheckboxMenuItem,   createChoice,   createDialog,   createDragSourceContextPeer,   createFileDialog,   createFrame,   createImage,   createImage,   createImage,   createImage,   createInputMethodWindow,   createKeyboardFocusManagerPeer,   createLabel,   createList,   createMenu,   createMenuBar,   createMenuItem,   createNewAppContext,   createPanel,   createPopupMenu,   createRobot,   createScrollPane,   createScrollbar,   createSystemTray,   createTextArea,   createTextField,   createTrayIcon,   createWindow,   disableBackgroundErase,   disableBackgroundErase,   dumpPeers,   enableInputMethodsForTextComponent,   executeOnEDTAndWait,   executeOnEventHandlerThread,   executeOnEventHandlerThread,   executeOnEventHandlerThread,   flushPendingEvents,   getBooleanSystemProperty,   getContainingWindow,   getDataTransfererClassName,   getDefaultKeyboardLocale,   getDesktopAAHints,   getDesktopFontHints,   getField,   getFontList,   getFontMetrics,   getFontPeer,   getHeavyweightComponent,   getImage,   getImage,   getImageFromHash,   getImageFromHash,   getMethod,   getMouseInfoPeer,   getNativeContainer,   getNumberOfButtons,   getScaledIconData,   getScaledIconImage,   getScreenHeight,   getScreenSize,   getScreenWidth,   getStartupLocale,   getSunAwtDisableMixing,   getSunAwtErasebackgroundonresize,   getSunAwtNoerasebackground,   getSystemEventQueueImpl,   getSystemEventQueueImplPP,   getSystemEventQueueImplPP,   getSystemProperty,   getWindowClosingListener,   grab,   insertTargetMapping,   invokeLaterOnAppContext,   isAWTLockHeldByCurrentThread,   isContainingTopLevelOpaque,   isContainingTopLevelTranslucent,   isDesktopSupported,   isDispatchThreadForAppContext,   isInstanceOf,   isLightweightOrUnknown,   isModalExcluded,   isModalExcludedSupported,   isModalExcludedSupportedImpl,   isModalExclusionTypeSupported,   isModalityTypeSupported,   isNativeGTKAvailable,   isPostEventQueueEmpty,   isSystemGenerated,   isTranslucencyCapable,   isTraySupported,   isWindowOpacitySupported,   isWindowShapingSupported,   isWindowTranslucencySupported,   isXEmbedServerRequested,   needUpdateWindow,   needsXEmbed,   needsXEmbedImpl,   notifyModalityChange,   notifyModalityPopped,   notifyModalityPushed,   postEvent,   postPriorityEvent,   prepareImage,   realSync,   realSync,   removeModalityListener,   setAAFontSettingsCondition,   setDataTransfererClassName,   setLWRequestStatus,   setModalExcluded,   setSystemGenerated,   setWindowClosingListener,   syncNativeQueue,   targetCreatedPeer,   targetDisposedPeer,   targetToAppContext,   targetToPeer,   ungrab,   useBufferPerWindow,   waitForIdle,   wakeupEventQueue,   windowClosingDelivered,   windowClosingNotify
Methods from java.awt.Toolkit:
access$000,   access$002,   access$102,   addAWTEventListener,   addPropertyChangeListener,   beep,   checkImage,   countAWTEventListeners,   createButton,   createCanvas,   createCheckbox,   createCheckboxMenuItem,   createChoice,   createComponent,   createCustomCursor,   createDesktopPeer,   createDialog,   createDragGestureRecognizer,   createDragSourceContextPeer,   createFileDialog,   createFrame,   createImage,   createImage,   createImage,   createImage,   createImage,   createLabel,   createList,   createMenu,   createMenuBar,   createMenuItem,   createPanel,   createPopupMenu,   createScrollPane,   createScrollbar,   createTextArea,   createTextField,   createWindow,   enabledOnToolkit,   getAWTEventListeners,   getAWTEventListeners,   getBestCursorSize,   getColorModel,   getDefaultToolkit,   getDesktopProperty,   getEventQueue,   getFontList,   getFontMetrics,   getFontPeer,   getImage,   getImage,   getLockingKeyState,   getMaximumCursorColors,   getMenuShortcutKeyMask,   getMouseInfoPeer,   getNativeContainer,   getPrintJob,   getPrintJob,   getProperty,   getPropertyChangeListeners,   getPropertyChangeListeners,   getScreenInsets,   getScreenResolution,   getScreenSize,   getSystemClipboard,   getSystemEventQueue,   getSystemEventQueueImpl,   getSystemSelection,   initializeDesktopProperties,   isAlwaysOnTopSupported,   isDynamicLayoutActive,   isDynamicLayoutSet,   isFrameStateSupported,   isModalExclusionTypeSupported,   isModalityTypeSupported,   lazilyLoadDesktopProperty,   loadLibraries,   loadSystemColors,   mapInputMethodHighlight,   notifyAWTEventListeners,   prepareImage,   removeAWTEventListener,   removePropertyChangeListener,   setDesktopProperty,   setDynamicLayout,   setLockingKeyState,   sync
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.awt.SunToolkit Detail:
 public  void addModalityListener(ModalityListener listener) 
 public static final  void awtLock() 
 public static final  void awtLockNotify() 
 public static final  void awtLockNotifyAll() 
 public static final  void awtLockWait() throws InterruptedException 
 public static final  void awtLockWait(long timeout) throws InterruptedException 
 public static final boolean awtTryLock() 
 public static final  void awtUnlock() 
 public static  void checkAndSetPolicy(Container cont,
    boolean isSwingCont) 
 public int checkImage(Image img,
    int w,
    int h,
    ImageObserver o) 
 public static native  void closeSplashScreen()
    Locates the splash screen library in a platform dependent way and closes the splash screen. Should be invoked on first top-level frame display.
 public static synchronized  void consumeNextKeyTyped(KeyEvent keyEvent) 
 abstract public ButtonPeer createButton(Button target) throws HeadlessException
 public CanvasPeer createCanvas(Canvas target) 
 abstract public CheckboxPeer createCheckbox(Checkbox target) throws HeadlessException
 abstract public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) throws HeadlessException
 abstract public ChoicePeer createChoice(Choice target) throws HeadlessException
 abstract public DialogPeer createDialog(Dialog target) throws HeadlessException
 abstract public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException
 abstract public FileDialogPeer createFileDialog(FileDialog target) throws HeadlessException
 abstract public FramePeer createFrame(Frame target) throws HeadlessException
 public Image createImage(String filename) 
 public Image createImage(URL url) 
 public Image createImage(ImageProducer producer) 
 public Image createImage(byte[] data,
    int offset,
    int length) 
 public Window createInputMethodWindow(String title,
    InputContext context) 
    Returns a new input method window, with behavior as specified in java.awt.im.spi.InputMethodContext#createInputMethodWindow . If the inputContext is not null, the window should return it from its getInputContext() method. The window needs to implement sun.awt.im.InputMethodWindow.

    SunToolkit subclasses can override this method to return better input method windows.

 abstract public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) throws HeadlessException
 abstract public LabelPeer createLabel(Label target) throws HeadlessException
 abstract public ListPeer createList(List target) throws HeadlessException
 abstract public MenuPeer createMenu(Menu target) throws HeadlessException
 abstract public MenuBarPeer createMenuBar(MenuBar target) throws HeadlessException
 abstract public MenuItemPeer createMenuItem(MenuItem target) throws HeadlessException
 public static AppContext createNewAppContext() 
 public PanelPeer createPanel(Panel target) 
 abstract public PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException
 abstract public RobotPeer createRobot(Robot target,
    GraphicsDevice screen) throws AWTException
 abstract public ScrollPanePeer createScrollPane(ScrollPane target) throws HeadlessException
 abstract public ScrollbarPeer createScrollbar(Scrollbar target) throws HeadlessException
 abstract public SystemTrayPeer createSystemTray(SystemTray target)
 abstract public TextAreaPeer createTextArea(TextArea target) throws HeadlessException
 abstract public TextFieldPeer createTextField(TextField target) throws HeadlessException
 abstract public TrayIconPeer createTrayIcon(TrayIcon target) throws HeadlessException, AWTException
 abstract public WindowPeer createWindow(Window target) throws HeadlessException
 public  void disableBackgroundErase(Canvas canvas) 
    Disables erasing of background on the canvas before painting if this is supported by the current toolkit. It is recommended to call this method early, before the Canvas becomes displayable, because some Toolkit implementations do not support changing this property once the Canvas becomes displayable.
 public  void disableBackgroundErase(Component component) 
    Disables the native erasing of the background on the given component before painting if this is supported by the current toolkit. This only has an effect for certain components such as Canvas, Panel and Window. It is recommended to call this method early, before the Component becomes displayable, because some Toolkit implementations do not support changing this property once the Component becomes displayable.
 protected static  void dumpPeers(PlatformLogger aLog) 
 public boolean enableInputMethodsForTextComponent() 
    Returns whether enableInputMethods should be set to true for peered TextComponent instances on this platform. False by default.
 public static  void executeOnEDTAndWait(Object target,
    Runnable runnable) throws InterruptedException, InvocationTargetException 
 public static  void executeOnEventHandlerThread(PeerEvent peerEvent) 
 public static  void executeOnEventHandlerThread(Object target,
    Runnable runnable) 
 public static  void executeOnEventHandlerThread(Object target,
    Runnable runnable,
    long when) 
 public static  void flushPendingEvents() 
 protected static Boolean getBooleanSystemProperty(String key) 
    Returns the boolean value of the system property indicated by the specified key.
 public static Window getContainingWindow(Component comp) 
    Returns the Window ancestor of the component comp.
 public static String getDataTransfererClassName() 
 public Locale getDefaultKeyboardLocale() 
    Returns the default keyboard locale of the underlying operating system
 protected RenderingHints getDesktopAAHints() 
 public static RenderingHints getDesktopFontHints() 
 public static Field getField(Class klass,
    String fieldName) 
 public String[] getFontList() 
 public FontMetrics getFontMetrics(Font font) 
 abstract public FontPeer getFontPeer(String name,
    int style)
 public static Component getHeavyweightComponent(Component c) 
    Gives native peers the ability to query the closest HW component. If the given component is heavyweight, then it returns this. Otherwise, it goes one level up in the hierarchy and tests next component.
 public Image getImage(String filename) 
 public Image getImage(URL url) 
 static Image getImageFromHash(Toolkit tk,
    URL url) 
 static Image getImageFromHash(Toolkit tk,
    String filename) 
 public static Method getMethod(Class clz,
    String methodName,
    Class[] params) 
 protected synchronized MouseInfoPeer getMouseInfoPeer() 
 public static Container getNativeContainer(Component c) 
    Give native peers the ability to query the native container given a native component (eg the direct parent may be lightweight).
 public int getNumberOfButtons() 
    Descendants of the SunToolkit should override and put their own logic here.
 public static DataBufferInt getScaledIconData(List<Image> imageList,
    int width,
    int height) 
 public static BufferedImage getScaledIconImage(List<Image> imageList,
    int width,
    int height) 
    Scans {@code imageList} for best-looking image of specified dimensions. Image can be scaled and/or padded with transparency.
 abstract protected int getScreenHeight()
 public Dimension getScreenSize() 
 abstract protected int getScreenWidth()
 public static Locale getStartupLocale() 
    Returns the locale in which the runtime was started.
 public static synchronized boolean getSunAwtDisableMixing() 
    Returns the value of "sun.awt.disableMixing" property. Default value is {@code false}.
 public static boolean getSunAwtErasebackgroundonresize() 
    Returns the value of "sun.awt.erasebackgroundonresize" property. Default value is {@code false}.
 public static boolean getSunAwtNoerasebackground() 
    Returns the value of "sun.awt.noerasebackground" property. Default value is {@code false}.
 protected EventQueue getSystemEventQueueImpl() 
 static EventQueue getSystemEventQueueImplPP() 
 public static EventQueue getSystemEventQueueImplPP(AppContext appContext) 
 public static String getSystemProperty(String key) 
    Returns the value of the system property indicated by the specified key.
 public WindowClosingListener getWindowClosingListener() 
 abstract public  void grab(Window w)
    Grabs the mouse input for the given window. The window must be visible. The window or its children do not receive any additional mouse events besides those targeted to them. All other events will be dispatched as before - to the respective targets. This Window will receive UngrabEvent when automatic ungrab is about to happen. The event can be listened to by installing AWTEventListener with WINDOW_EVENT_MASK. See UngrabEvent class for the list of conditions when ungrab is about to happen.
 public static  void insertTargetMapping(Object target,
    AppContext appContext) 
 public static  void invokeLaterOnAppContext(AppContext appContext,
    Runnable dispatcher) 
 public static final boolean isAWTLockHeldByCurrentThread() 
 public static boolean isContainingTopLevelOpaque(Component c) 
 public static boolean isContainingTopLevelTranslucent(Component c) 
    Returns whether or not a containing top level window for the passed component is TRANSLUCENT .
 abstract public boolean isDesktopSupported()
 public static boolean isDispatchThreadForAppContext(Object target) 
 public static boolean isInstanceOf(Object obj,
    String type) 
    Checks that the given object implements/extends the given interface/class. Note that using the instanceof operator causes a class to be loaded. Using this method doesn't load a class and it can be used instead of the instanceof operator for performance reasons.
 public static boolean isLightweightOrUnknown(Component comp) 
 public static boolean isModalExcluded(Window window) 
 public static boolean isModalExcludedSupported() 
    Returns whether the modal exclusion API is supported by the current toolkit. When it isn't supported, calling setModalExcluded has no effect, and isModalExcluded returns false for all windows.
 protected boolean isModalExcludedSupportedImpl() 
 public boolean isModalExclusionTypeSupported(ModalExclusionType exclusionType) 
    Overridden in XToolkit and WToolkit
 public boolean isModalityTypeSupported(ModalityType modalityType) 
    Overridden in XToolkit and WToolkit
 public boolean isNativeGTKAvailable() 
    Returns true if the native GTK libraries are available. The default implementation returns false, but UNIXToolkit overrides this method to provide a more specific answer.
 public static boolean isPostEventQueueEmpty() 
 public static boolean isSystemGenerated(AWTEvent e) 
 public boolean isTranslucencyCapable(GraphicsConfiguration gc) 
 abstract public boolean isTraySupported()
 public boolean isWindowOpacitySupported() 
 public boolean isWindowShapingSupported() 
 public boolean isWindowTranslucencySupported() 
 protected final boolean isXEmbedServerRequested() 
    Returns whether the XEmbed server feature is requested by developer. If true, Toolkit should return an XEmbed-server-enabled CanvasPeer instead of the ordinary CanvasPeer.
 public boolean needUpdateWindow() 
    Returns whether the native system requires using the peer.updateWindow() method to update the contents of a non-opaque window, or if usual painting procedures are sufficient. The default return value covers the X11 systems. On MS Windows this method is overriden in WToolkit to return true.
 public static boolean needsXEmbed() 
    Returns whether default toolkit needs the support of the xembed from embedding host(if any).
 protected boolean needsXEmbedImpl() 
    Returns whether this toolkit needs the support of the xembed from embedding host(if any).
 final  void notifyModalityChange(int id,
    Dialog source) 
 public  void notifyModalityPopped(Dialog dialog) 
 public  void notifyModalityPushed(Dialog dialog) 
 public static  void postEvent(AppContext appContext,
    AWTEvent event) 
 public static  void postPriorityEvent(AWTEvent e) 
 public boolean prepareImage(Image img,
    int w,
    int h,
    ImageObserver o) 
 public  void realSync() throws OperationTimedOut, InfiniteLoop 
    Parameterless version of realsync which uses default timout (see DEFAUL_WAIT_TIME).
 public  void realSync(long timeout) throws OperationTimedOut, InfiniteLoop 
    Forces toolkit to synchronize with the native windowing sub-system, flushing all pending work and waiting for all the events to be processed. This method guarantees that after return no additional Java events will be generated, unless cause by user. Obviously, the method cannot be used on the event dispatch thread (EDT). In case it nevertheless gets invoked on this thread, the method throws the IllegalThreadException runtime exception.

    This method allows to write tests without explicit timeouts or wait for some event. Example: Frame f = ...; f.setVisible(true); ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();

    After realSync, f will be completely visible on the screen, its getLocationOnScreen will be returning the right result and it will be the focus owner.

    Another example: b.requestFocus(); ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();

    After realSync, b will be focus owner.

    Notice that realSync isn't guaranteed to work if recurring actions occur, such as if during processing of some event another request which may generate some events occurs. By default, sync tries to perform as much as {@value MAX_ITERS} cycles of event processing, allowing for roughly {@value MAX_ITERS} additional requests.

    For example, requestFocus() generates native request, which generates one or two Java focus events, which then generate a serie of paint events, a serie of Java focus events, which then generate a serie of paint events which then are processed - three cycles, minimum.

 public  void removeModalityListener(ModalityListener listener) 
 public static  void setAAFontSettingsCondition(boolean extraCondition) 
 protected static  void setDataTransfererClassName(String className) 
 public static  void setLWRequestStatus(Window changed,
    boolean status) 
    Sets the synchronous status of focus requests on lightweight components in the specified window to the specified value. If the boolean parameter is true then the focus requests on lightweight components will be performed synchronously, if it is false, then asynchronously. By default, all windows have their lightweight request status set to asynchronous.

    The application can only set the status of lightweight focus requests to synchronous for any of its windows if it doesn't perform focus transfers between different heavyweight containers. In this case the observable focus behaviour is the same as with asynchronous status.

    If the application performs focus transfer between different heavyweight containers and sets the lightweight focus request status to synchronous for any of its windows, then further focus behaviour is unspecified.

 public static  void setModalExcluded(Window window) 
 public static  void setSystemGenerated(AWTEvent e) 
 public  void setWindowClosingListener(WindowClosingListener wcl) 
 abstract protected boolean syncNativeQueue(long timeout)
    Platform toolkits need to implement this method to perform the sync of the native queue. The method should wait until native requests are processed, all native events are processed and corresponding Java events are generated. Should return true if some events were processed, false otherwise.
 protected static  void targetCreatedPeer(Object target,
    Object peer) 
 protected static  void targetDisposedPeer(Object target,
    Object peer) 
 public static AppContext targetToAppContext(Object target) 
 protected static Object targetToPeer(Object target) 
 abstract public  void ungrab(Window w)
    Forces ungrab. No event will be sent.
 public boolean useBufferPerWindow() 
 protected final boolean waitForIdle(long timeout) 
    Waits for the Java event queue to empty. Ensures that all events are processed (including paint events), and that if recursive events were generated, they are also processed. Should return true if more processing is necessary, false otherwise.
 static  void wakeupEventQueue(EventQueue q,
    boolean isShutdown) 
 public RuntimeException windowClosingDelivered(WindowEvent event) 
 public RuntimeException windowClosingNotify(WindowEvent event)