public abstract class

SunToolkit

extends Toolkit
implements ComponentFactory InputMethodSupport WindowClosingListener WindowClosingSupport
java.lang.Object
   ↳ java.awt.Toolkit
     ↳ sun.awt.SunToolkit

Summary

Nested Classes
class SunToolkit.IllegalThreadException  
class SunToolkit.InfiniteLoop  
class SunToolkit.OperationTimedOut  
Constants
int DEFAULT_WAIT_TIME
String DESKTOPFONTHINTS
int GRAB_EVENT_MASK Special mask for the UngrabEvent events, in addition to the public masks defined in AWTEvent.
[Expand]
Inherited Fields
From class java.awt.Toolkit
Public Constructors
SunToolkit()
Public Methods
void addModalityListener(ModalityListener listener)
final static void awtLock()
final static void awtLockNotify()
final static void awtLockNotifyAll()
final static void awtLockWait(long timeout)
final static void awtLockWait()
final static boolean awtTryLock()
final static void awtUnlock()
static void checkAndSetPolicy(Container cont, boolean isSwingCont)
int checkImage(Image img, int w, int h, ImageObserver o)
Indicates the construction status of a specified image that is being prepared for display.
static void closeSplashScreen()
Locates the splash screen library in a platform dependent way and closes the splash screen.
synchronized static void consumeNextKeyTyped(KeyEvent keyEvent)
abstract ButtonPeer createButton(Button target)
Creates this toolkit's implementation of Button using the specified peer interface.
CanvasPeer createCanvas(Canvas target)
Creates this toolkit's implementation of Canvas using the specified peer interface.
abstract CheckboxPeer createCheckbox(Checkbox target)
Creates this toolkit's implementation of Checkbox using the specified peer interface.
abstract CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
Creates this toolkit's implementation of CheckboxMenuItem using the specified peer interface.
abstract ChoicePeer createChoice(Choice target)
Creates this toolkit's implementation of Choice using the specified peer interface.
abstract DialogPeer createDialog(Dialog target)
Creates this toolkit's implementation of Dialog using the specified peer interface.
abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
Creates the peer for a DragSourceContext.
abstract FileDialogPeer createFileDialog(FileDialog target)
Creates this toolkit's implementation of FileDialog using the specified peer interface.
abstract FramePeer createFrame(Frame target)
Creates this toolkit's implementation of Frame using the specified peer interface.
Image createImage(byte[] data, int offset, int length)
Creates an image which decodes the image stored in the specified byte array, and at the specified offset and length.
Image createImage(String filename)
Returns an image which gets pixel data from the specified file.
Image createImage(ImageProducer producer)
Creates an image with the specified image producer.
Image createImage(URL url)
Returns an image which gets pixel data from the specified URL.
Window createInputMethodWindow(String title, InputContext context)
Returns a new input method window, with behavior as specified in createInputMethodWindow(String, boolean).
KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager)
abstract LabelPeer createLabel(Label target)
Creates this toolkit's implementation of Label using the specified peer interface.
abstract ListPeer createList(List target)
Creates this toolkit's implementation of List using the specified peer interface.
abstract MenuPeer createMenu(Menu target)
Creates this toolkit's implementation of Menu using the specified peer interface.
abstract MenuBarPeer createMenuBar(MenuBar target)
Creates this toolkit's implementation of MenuBar using the specified peer interface.
abstract MenuItemPeer createMenuItem(MenuItem target)
Creates this toolkit's implementation of MenuItem using the specified peer interface.
static AppContext createNewAppContext()
PanelPeer createPanel(Panel target)
Creates this toolkit's implementation of Panel using the specified peer interface.
abstract PopupMenuPeer createPopupMenu(PopupMenu target)
Creates this toolkit's implementation of PopupMenu using the specified peer interface.
abstract RobotPeer createRobot(Robot target, GraphicsDevice screen)
abstract ScrollPanePeer createScrollPane(ScrollPane target)
Creates this toolkit's implementation of ScrollPane using the specified peer interface.
abstract ScrollbarPeer createScrollbar(Scrollbar target)
Creates this toolkit's implementation of Scrollbar using the specified peer interface.
abstract SystemTrayPeer createSystemTray(SystemTray target)
abstract TextAreaPeer createTextArea(TextArea target)
Creates this toolkit's implementation of TextArea using the specified peer interface.
abstract TextFieldPeer createTextField(TextField target)
Creates this toolkit's implementation of TextField using the specified peer interface.
abstract TrayIconPeer createTrayIcon(TrayIcon target)
abstract WindowPeer createWindow(Window target)
Creates this toolkit's implementation of Window using the specified peer interface.
void disableBackgroundErase(Canvas canvas)
Disables erasing of background on the canvas before painting if this is supported by the current toolkit.
boolean enableInputMethodsForTextComponent()
Returns whether enableInputMethods should be set to true for peered TextComponent instances on this platform.
static void executeOnEDTAndWait(Object target, Runnable runnable)
static void executeOnEventHandlerThread(Object target, Runnable runnable, long when)
static void executeOnEventHandlerThread(PeerEvent peerEvent)
static void executeOnEventHandlerThread(Object target, Runnable runnable)
static void flushPendingEvents()
static String getDataTransfererClassName()
Locale getDefaultKeyboardLocale()
Returns the default keyboard locale of the underlying operating system
static RenderingHints getDesktopFontHints()
static Field getField(Class klass, String fieldName)
String[] getFontList()
This method is deprecated. see getAvailableFontFamilyNames()
FontMetrics getFontMetrics(Font font)
This method is deprecated. As of JDK version 1.2, replaced by the Font method getLineMetrics.
abstract FontPeer getFontPeer(String name, int style)
This method is deprecated. see java.awt.GraphicsEnvironment#getAllFonts
Image getImage(String filename)
Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG.
Image getImage(URL url)
Returns an image which gets pixel data from the specified URL.
static Method getMethod(Class clz, String methodName, Class[] params)
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).
static DataBufferInt getScaledIconData(List<Image> imageList, int width, int height)
static BufferedImage getScaledIconImage(List<Image> imageList, int width, int height)
Scans imageList for best-looking image of specified dimensions.
Dimension getScreenSize()
Gets the size of the screen.
static Locale getStartupLocale()
Returns the locale in which the runtime was started.
static boolean getSunAwtErasebackgroundonresize()
Returns the value of "sun.awt.erasebackgroundonresize" property.
static boolean getSunAwtNoerasebackground()
Returns the value of "sun.awt.noerasebackground" property.
static EventQueue getSystemEventQueueImplPP(AppContext appContext)
WindowClosingListener getWindowClosingListener()
abstract void grab(Window w)
Grabs the mouse input for the given window.
static void insertTargetMapping(Object target, AppContext appContext)
static void invokeLaterOnAppContext(AppContext appContext, Runnable dispatcher)
final static boolean isAWTLockHeldByCurrentThread()
abstract boolean isDesktopSupported()
static boolean isDispatchThreadForAppContext(Object target)
static boolean isLightweightOrUnknown(Component comp)
static boolean isModalExcluded(Window window)
static boolean isModalExcludedSupported()
Returns whether the modal exclusion API is supported by the current toolkit.
boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType)
Overridden in XToolkit and WToolkit
boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
Overridden in XToolkit and WToolkit
boolean isNativeGTKAvailable()
Returns true if the native GTK libraries are available.
static boolean isPostEventQueueEmpty()
abstract boolean isTraySupported()
static boolean needsXEmbed()
Returns whether default toolkit needs the support of the xembed from embedding host(if any).
void notifyModalityPopped(Dialog dialog)
void notifyModalityPushed(Dialog dialog)
static void postEvent(AppContext appContext, AWTEvent event)
static void postPriorityEvent(AWTEvent e)
boolean prepareImage(Image img, int w, int h, ImageObserver o)
Prepares an image for rendering.
void realSync()
Parameterless version of realsync which uses default timout (see DEFAUL_WAIT_TIME).
void realSync(long timeout)
Forces toolkit to synchronize with the native windowing sub-system, flushing all pending work and waiting for all the events to be processed.
void removeModalityListener(ModalityListener listener)
static void setAAFontSettingsCondition(boolean extraCondition)
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.
static void setModalExcluded(Window window)
void setOverrideRedirect(Window target)
Makes the window OverrideRedirect, on X11 platforms.
void setWindowClosingListener(WindowClosingListener wcl)
static AppContext targetToAppContext(Object target)
abstract void ungrab(Window w)
Forces ungrab.
boolean useBufferPerWindow()
RuntimeException windowClosingDelivered(WindowEvent event)
Called after a WINDOW_CLOSING event gets posted to the queue.
RuntimeException windowClosingNotify(WindowEvent event)
Called before a WINDOW_CLOSING event gets posted to the queue.
Protected Methods
static void dumpPeers(Logger aLog)
RenderingHints getDesktopAAHints()
synchronized MouseInfoPeer getMouseInfoPeer()
Obtains this toolkit's implementation of helper class for MouseInfo operations.
abstract int getScreenHeight()
abstract int getScreenWidth()
EventQueue getSystemEventQueueImpl()
Gets the application's or applet's EventQueue instance, without checking access.
boolean isModalExcludedSupportedImpl()
final boolean isXEmbedServerRequested()
Returns whether the XEmbed server feature is requested by developer.
boolean needsXEmbedImpl()
Returns whether this toolkit needs the support of the xembed from embedding host(if any).
static void setDataTransfererClassName(String className)
abstract boolean syncNativeQueue(long timeout)
Platform toolkits need to implement this method to perform the sync of the native queue.
static void targetCreatedPeer(Object target, Object peer)
static void targetDisposedPeer(Object target, Object peer)
static Object targetToPeer(Object target)
final boolean waitForIdle(long timeout)
Waits for the Java event queue to empty.
[Expand]
Inherited Methods
From class java.awt.Toolkit
From class java.lang.Object
From interface sun.awt.ComponentFactory
From interface sun.awt.InputMethodSupport
From interface sun.awt.WindowClosingListener
From interface sun.awt.WindowClosingSupport

Constants

public static final int DEFAULT_WAIT_TIME

Constant Value: 10000 (0x00002710)

public static final String DESKTOPFONTHINTS

Constant Value: "awt.font.desktophints"

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.

Constant Value: -2147483648 (0x80000000)

Public Constructors

public SunToolkit ()

Public Methods

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 (long timeout)

public static final void awtLockWait ()

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)

Indicates the construction status of a specified image that is being prepared for display.

If the values of the width and height arguments are both -1, this method returns the construction status of a screen representation of the specified image in this toolkit. Otherwise, this method returns the construction status of a scaled representation of the image at the specified width and height.

This method does not cause the image to begin loading. An application must call prepareImage to force the loading of an image.

This method is called by the component's checkImage methods.

Information on the flags returned by this method can be found with the definition of the ImageObserver interface.

Parameters
img the image whose status is being checked.
w the width of the scaled version whose status is being checked, or -1.
h the height of the scaled version whose status is being checked, or -1.
o the ImageObserver object to be notified as the image is being prepared.
Returns
  • the bitwise inclusive OR of the ImageObserver flags for the image data that is currently available.

public static 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.

See Also

public static synchronized void consumeNextKeyTyped (KeyEvent keyEvent)

public abstract ButtonPeer createButton (Button target)

Creates this toolkit's implementation of Button using the specified peer interface.

Parameters
target the button to be implemented.
Returns
  • this toolkit's implementation of Button.

public CanvasPeer createCanvas (Canvas target)

Creates this toolkit's implementation of Canvas using the specified peer interface.

Parameters
target the canvas to be implemented.
Returns
  • this toolkit's implementation of Canvas.

public abstract CheckboxPeer createCheckbox (Checkbox target)

Creates this toolkit's implementation of Checkbox using the specified peer interface.

Parameters
target the check box to be implemented.
Returns
  • this toolkit's implementation of Checkbox.

public abstract CheckboxMenuItemPeer createCheckboxMenuItem (CheckboxMenuItem target)

Creates this toolkit's implementation of CheckboxMenuItem using the specified peer interface.

Parameters
target the checkbox menu item to be implemented.
Returns
  • this toolkit's implementation of CheckboxMenuItem.

public abstract ChoicePeer createChoice (Choice target)

Creates this toolkit's implementation of Choice using the specified peer interface.

Parameters
target the choice to be implemented.
Returns
  • this toolkit's implementation of Choice.

public abstract DialogPeer createDialog (Dialog target)

Creates this toolkit's implementation of Dialog using the specified peer interface.

Parameters
target the dialog to be implemented.
Returns
  • this toolkit's implementation of Dialog.

public abstract DragSourceContextPeer createDragSourceContextPeer (DragGestureEvent dge)

Creates the peer for a DragSourceContext. Always throws InvalidDndOperationException if GraphicsEnvironment.isHeadless() returns true.

public abstract FileDialogPeer createFileDialog (FileDialog target)

Creates this toolkit's implementation of FileDialog using the specified peer interface.

Parameters
target the file dialog to be implemented.
Returns
  • this toolkit's implementation of FileDialog.

public abstract FramePeer createFrame (Frame target)

Creates this toolkit's implementation of Frame using the specified peer interface.

Parameters
target the frame to be implemented.
Returns
  • this toolkit's implementation of Frame.

public Image createImage (byte[] data, int offset, int length)

Creates an image which decodes the image stored in the specified byte array, and at the specified offset and length. The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.

Parameters
data an array of bytes, representing image data in a supported image format.
offset the offset of the beginning of the data in the array.
length the length of the data in the array.
Returns
  • an image.

public Image createImage (String filename)

Returns an image which gets pixel data from the specified file. The returned Image is a new object which will not be shared with any other caller of this method or its getImage variant.

This method first checks if there is a security manager installed. If so, the method calls the security manager's checkRead method with the specified file to ensure that the image creation is allowed.

Parameters
filename the name of a file containing pixel data in a recognized file format.
Returns
  • an image which gets its pixel data from the specified file.

public Image createImage (ImageProducer producer)

Creates an image with the specified image producer.

Parameters
producer the image producer to be used.
Returns
  • an image with the specified image producer.

public Image createImage (URL url)

Returns an image which gets pixel data from the specified URL. The returned Image is a new object which will not be shared with any other caller of this method or its getImage variant.

This method first checks if there is a security manager installed. If so, the method calls the security manager's checkPermission method with the url.openConnection().getPermission() permission to ensure that the image creation is allowed. For compatibility with pre-1.2 security managers, if the access is denied with FilePermission or SocketPermission, the method throws SecurityException if the corresponding 1.1-style SecurityManager.checkXXX method also denies permission.

Parameters
url the URL to use in fetching the pixel data.
Returns
  • an image which gets its pixel data from the specified URL.

public Window createInputMethodWindow (String title, InputContext context)

Returns a new input method window, with behavior as specified in createInputMethodWindow(String, boolean). 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.

public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer (KeyboardFocusManager manager)

public abstract LabelPeer createLabel (Label target)

Creates this toolkit's implementation of Label using the specified peer interface.

Parameters
target the label to be implemented.
Returns
  • this toolkit's implementation of Label.

public abstract ListPeer createList (List target)

Creates this toolkit's implementation of List using the specified peer interface.

Parameters
target the list to be implemented.
Returns
  • this toolkit's implementation of List.

public abstract MenuPeer createMenu (Menu target)

Creates this toolkit's implementation of Menu using the specified peer interface.

Parameters
target the menu to be implemented.
Returns
  • this toolkit's implementation of Menu.

public abstract MenuBarPeer createMenuBar (MenuBar target)

Creates this toolkit's implementation of MenuBar using the specified peer interface.

Parameters
target the menu bar to be implemented.
Returns
  • this toolkit's implementation of MenuBar.

public abstract MenuItemPeer createMenuItem (MenuItem target)

Creates this toolkit's implementation of MenuItem using the specified peer interface.

Parameters
target the menu item to be implemented.
Returns
  • this toolkit's implementation of MenuItem.

public static AppContext createNewAppContext ()

public PanelPeer createPanel (Panel target)

Creates this toolkit's implementation of Panel using the specified peer interface.

Parameters
target the panel to be implemented.
Returns
  • this toolkit's implementation of Panel.

public abstract PopupMenuPeer createPopupMenu (PopupMenu target)

Creates this toolkit's implementation of PopupMenu using the specified peer interface.

Parameters
target the popup menu to be implemented.
Returns
  • this toolkit's implementation of PopupMenu.

public abstract RobotPeer createRobot (Robot target, GraphicsDevice screen)

Throws
AWTException

public abstract ScrollPanePeer createScrollPane (ScrollPane target)

Creates this toolkit's implementation of ScrollPane using the specified peer interface.

Parameters
target the scroll pane to be implemented.
Returns
  • this toolkit's implementation of ScrollPane.

public abstract ScrollbarPeer createScrollbar (Scrollbar target)

Creates this toolkit's implementation of Scrollbar using the specified peer interface.

Parameters
target the scroll bar to be implemented.
Returns
  • this toolkit's implementation of Scrollbar.

public abstract SystemTrayPeer createSystemTray (SystemTray target)

public abstract TextAreaPeer createTextArea (TextArea target)

Creates this toolkit's implementation of TextArea using the specified peer interface.

Parameters
target the text area to be implemented.
Returns
  • this toolkit's implementation of TextArea.

public abstract TextFieldPeer createTextField (TextField target)

Creates this toolkit's implementation of TextField using the specified peer interface.

Parameters
target the text field to be implemented.
Returns
  • this toolkit's implementation of TextField.

public abstract TrayIconPeer createTrayIcon (TrayIcon target)

public abstract WindowPeer createWindow (Window target)

Creates this toolkit's implementation of Window using the specified peer interface.

Parameters
target the window to be implemented.
Returns
  • this toolkit's implementation of Window.

public void disableBackgroundErase (Canvas canvas)

Disables erasing of background on the canvas before painting if this is supported by the current toolkit.

Throws
IllegalStateException if the canvas is not displayable
See Also

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)

public static void executeOnEventHandlerThread (Object target, Runnable runnable, long when)

public static void executeOnEventHandlerThread (PeerEvent peerEvent)

public static void executeOnEventHandlerThread (Object target, Runnable runnable)

public static void flushPendingEvents ()

public static String getDataTransfererClassName ()

public Locale getDefaultKeyboardLocale ()

Returns the default keyboard locale of the underlying operating system

public static RenderingHints getDesktopFontHints ()

public static Field getField (Class klass, String fieldName)

public String[] getFontList ()

This method is deprecated.
see getAvailableFontFamilyNames()

Returns the names of the available fonts in this toolkit.

For 1.1, the following font names are deprecated (the replacement name follows):

  • TimesRoman (use Serif)
  • Helvetica (use SansSerif)
  • Courier (use Monospaced)

The ZapfDingbats fontname is also deprecated in 1.1 but the characters are defined in Unicode starting at 0x2700, and as of 1.1 Java supports those characters.

Returns
  • the names of the available fonts in this toolkit.

public FontMetrics getFontMetrics (Font font)

This method is deprecated.
As of JDK version 1.2, replaced by the Font method getLineMetrics.

Gets the screen device metrics for rendering of the font.

Parameters
font a font
Returns
  • the screen metrics of the specified font in this toolkit

public abstract FontPeer getFontPeer (String name, int style)

This method is deprecated.
see java.awt.GraphicsEnvironment#getAllFonts

Creates this toolkit's implementation of Font using the specified peer interface.

Parameters
name the font to be implemented
style the style of the font, such as PLAIN, BOLD, ITALIC, or a combination
Returns
  • this toolkit's implementation of Font

public Image getImage (String filename)

Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG. The underlying toolkit attempts to resolve multiple requests with the same filename to the same returned Image.

Since the mechanism required to facilitate this sharing of Image objects may continue to hold onto images that are no longer in use for an indefinite period of time, developers are encouraged to implement their own caching of images by using the createImage variant wherever available. If the image data contained in the specified file changes, the Image object returned from this method may still contain stale information which was loaded from the file after a prior call. Previously loaded image data can be manually discarded by calling the flush method on the returned Image.

This method first checks if there is a security manager installed. If so, the method calls the security manager's checkRead method with the file specified to ensure that the access to the image is allowed.

Parameters
filename the name of a file containing pixel data in a recognized file format.
Returns
  • an image which gets its pixel data from the specified file.

public Image getImage (URL url)

Returns an image which gets pixel data from the specified URL. The pixel data referenced by the specified URL must be in one of the following formats: GIF, JPEG or PNG. The underlying toolkit attempts to resolve multiple requests with the same URL to the same returned Image.

Since the mechanism required to facilitate this sharing of Image objects may continue to hold onto images that are no longer in use for an indefinite period of time, developers are encouraged to implement their own caching of images by using the createImage variant wherever available. If the image data stored at the specified URL changes, the Image object returned from this method may still contain stale information which was fetched from the URL after a prior call. Previously loaded image data can be manually discarded by calling the flush method on the returned Image.

This method first checks if there is a security manager installed. If so, the method calls the security manager's checkPermission method with the url.openConnection().getPermission() permission to ensure that the access to the image is allowed. For compatibility with pre-1.2 security managers, if the access is denied with FilePermission or SocketPermission, the method throws the SecurityException if the corresponding 1.1-style SecurityManager.checkXXX method also denies permission.

Parameters
url the URL to use in fetching the pixel data.
Returns
  • an image which gets its pixel data from the specified URL.

public static Method getMethod (Class clz, String methodName, Class[] params)

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 static DataBufferInt getScaledIconData (List<Image> imageList, int width, int height)

public static BufferedImage getScaledIconImage (List<Image> imageList, int width, int height)

Scans imageList for best-looking image of specified dimensions. Image can be scaled and/or padded with transparency.

public Dimension getScreenSize ()

Gets the size of the screen. On systems with multiple displays, the primary display is used. Multi-screen aware display dimensions are available from GraphicsConfiguration and GraphicsDevice.

Returns
  • the size of this toolkit's screen, in pixels.

public static Locale getStartupLocale ()

Returns the locale in which the runtime was started.

public static boolean getSunAwtErasebackgroundonresize ()

Returns the value of "sun.awt.erasebackgroundonresize" property. Default value is false.

public static boolean getSunAwtNoerasebackground ()

Returns the value of "sun.awt.noerasebackground" property. Default value is false.

public static EventQueue getSystemEventQueueImplPP (AppContext appContext)

public WindowClosingListener getWindowClosingListener ()

public abstract 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.

See Also

public static void insertTargetMapping (Object target, AppContext appContext)

public static void invokeLaterOnAppContext (AppContext appContext, Runnable dispatcher)

public static final boolean isAWTLockHeldByCurrentThread ()

public abstract boolean isDesktopSupported ()

public static boolean isDispatchThreadForAppContext (Object target)

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.

Returns
  • true if modal exclusion is supported by the toolkit, false otherwise

public boolean isModalExclusionTypeSupported (Dialog.ModalExclusionType exclusionType)

Overridden in XToolkit and WToolkit

Parameters
exclusionType modal exclusion type to be checked for support by this toolkit
Returns
  • true, if current toolkit supports given modal exclusion type, false otherwise

public boolean isModalityTypeSupported (Dialog.ModalityType modalityType)

Overridden in XToolkit and WToolkit

Parameters
modalityType modality type to be checked for support by this toolkit
Returns
  • true, if current toolkit supports given modality type, false otherwise

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 abstract boolean isTraySupported ()

public static boolean needsXEmbed ()

Returns whether default toolkit needs the support of the xembed from embedding host(if any).

Returns
  • true, if XEmbed is needed, false otherwise

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)

Prepares an image for rendering.

If the values of the width and height arguments are both -1, this method prepares the image for rendering on the default screen; otherwise, this method prepares an image for rendering on the default screen at the specified width and height.

The image data is downloaded asynchronously in another thread, and an appropriately scaled screen representation of the image is generated.

This method is called by components prepareImage methods.

Information on the flags returned by this method can be found with the definition of the ImageObserver interface.

Parameters
img the image for which to prepare a screen representation.
w the width of the desired screen representation, or -1.
h the height of the desired screen representation, or -1.
o the ImageObserver object to be notified as the image is being prepared.
Returns
  • true if the image has already been fully prepared; false otherwise.

public void realSync ()

Parameterless version of realsync which uses default timout (see DEFAUL_WAIT_TIME).

public void realSync (long timeout)

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.

Parameters
timeout the maximum time to wait in milliseconds, negative means "forever".

public void removeModalityListener (ModalityListener listener)

public static void setAAFontSettingsCondition (boolean extraCondition)

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.

Parameters
status the value of lightweight focus request status

public static void setModalExcluded (Window window)

public void setOverrideRedirect (Window target)

Makes the window OverrideRedirect, on X11 platforms. See ICCCM specification for more details about OverrideRedirect windows. Implemented in XToolkit, no-op in WToolkit.

public void setWindowClosingListener (WindowClosingListener wcl)

public static AppContext targetToAppContext (Object target)

public abstract void ungrab (Window w)

Forces ungrab. No event will be sent.

public boolean useBufferPerWindow ()

public RuntimeException windowClosingDelivered (WindowEvent event)

Called after a WINDOW_CLOSING event gets posted to the queue.

Parameters
event The WINDOW_CLOSING event that has been posted.
Returns
  • A RuntimeException if the result of this function call needs to interrupt a blocking thread. The exception returned will be thrown from that thread. This function should return null otherwise.

public RuntimeException windowClosingNotify (WindowEvent event)

Called before a WINDOW_CLOSING event gets posted to the queue.

Parameters
event The WINDOW_CLOSING event that will be posted.
Returns
  • A RuntimeException if the result of this function call needs to interrupt a blocking thread. The exception returned will be thrown from that thread. This function should return null otherwise.

Protected Methods

protected static void dumpPeers (Logger aLog)

protected RenderingHints getDesktopAAHints ()

protected synchronized MouseInfoPeer getMouseInfoPeer ()

Obtains this toolkit's implementation of helper class for MouseInfo operations.

Returns
  • this toolkit's implementation of helper for MouseInfo

protected abstract int getScreenHeight ()

protected abstract int getScreenWidth ()

protected EventQueue getSystemEventQueueImpl ()

Gets the application's or applet's EventQueue instance, without checking access. For security reasons, this can only be called from a Toolkit subclass.

Returns
  • the EventQueue object

protected boolean isModalExcludedSupportedImpl ()

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.

protected boolean needsXEmbedImpl ()

Returns whether this toolkit needs the support of the xembed from embedding host(if any).

Returns
  • true, if XEmbed is needed, false otherwise

protected static void setDataTransfererClassName (String className)

protected abstract 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)

protected static Object targetToPeer (Object target)

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.