Top Inners Fields Constructors Methods
sun.awt

public abstract Class SunToolkit

Additional top-level class in compilation unit: PostEventQueue.

extends Toolkit
implements ComponentFactory, InputMethodSupport, KeyboardFocusManagerPeerProvider
Class Inheritance
All Implemented Interfaces
sun.awt.KeyboardFocusManagerPeerProvider, sun.awt.InputMethodSupport, sun.awt.ComponentFactory
Known Direct Subclasses
sun.awt.UNIXToolkit
Imports
java.awt.AWTEvent, .AWTException, .Button, .Canvas, .Checkbox, .Choice, .Component, .Container, .DefaultKeyboardFocusManager, .Dialog, .Dimension, .EventQueue, .FocusTraversalPolicy, .Font, .FontMetrics, .Graphics2D, .GraphicsConfiguration, .GraphicsDevice, .GraphicsEnvironment, .HeadlessException, .Image, .KeyboardFocusManager, .Label, .MenuComponent, .Panel, .RenderingHints, .ScrollPane, .Scrollbar, .SystemTray, .TextArea, .TextField, .Toolkit, .TrayIcon, .Window, java.awt.event.InputEvent, .KeyEvent, .WindowEvent, java.awt.image.BufferedImage, .ColorModel, .DataBuffer, .DataBufferInt, .ImageObserver, .ImageProducer, .MultiResolutionImage, .Raster, java.awt.peer.FramePeer, .KeyboardFocusManagerPeer, .SystemTrayPeer, .TrayIconPeer, java.io.File, .IOException, .InputStream, java.lang.reflect.InvocationTargetException, java.net.URL, java.security.AccessController, java.util.ArrayList, .Collections, .Locale, .Map, .Vector, .WeakHashMap, java.util.concurrent.TimeUnit, java.util.concurrent.atomic.AtomicBoolean, java.util.concurrent.locks.Condition, .ReentrantLock, sun.awt.im.InputContext, sun.awt.image.ByteArrayImageSource, .FileImageSource, .ImageRepresentation, .MultiResolutionToolkitImage, .ToolkitImage, .URLImageSource, sun.font.FontDesignMetrics, sun.net.util.URLUtil, sun.security.action.GetBooleanAction, .GetPropertyAction, sun.util.logging.PlatformLogger

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final Map<Object, AppContext>
private static final ReentrantLock
AWT_LOCK

The AWT lock is typically only used on Unix platforms to synchronize access to Xlib, OpenGL, etc. However, these methods are implemented in SunToolkit so that they can be called from shared code (e.g. from the OGL pipeline) or from the X11 pipeline regardless of whether XToolkit is currently in use.

private static final Condition
private static boolean
private static final Object
private static Dialog.ModalExclusionType
public static final int
private static RenderingHints
public static final String
pack-priv static final SoftCache
fileImgCache

Deprecated as a consequence of SoftCache being deprecated.
public static final int
GRAB_EVENT_MASK

Special mask for the UngrabEvent events, in addition to the public masks defined in AWTEvent.

private static boolean
public static final int
private static final int
private static final int
private static final int
private SunToolkit.ModalityListenerList
protected static int
numberOfButtons

Number of buttons.

private static final String
private static Locale
private static Boolean
private static boolean
pack-priv static final SoftCache
urlImgCache

Deprecated as a consequence of SoftCache being deprecated.
private static boolean
private final Object
Inherited from java.awt.Toolkit:
desktopPropertiesdesktopPropsSupport

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public static final void
public static final void
public static final void
public static final void
public static final void
awtLockWait(long timeout)

public static final boolean
public static final void
public boolean
canPopupOverlapTaskBar()

Returns whether popup is allowed to be shown above the task bar.

public static void
public int
checkImage(Image
the image whose status is being checked.
img
,
int
the width of the scaled version whose status is being checked, or -1.
w
,
int
the height of the scaled version whose status is being checked, or -1.
h
,
ImageObserver
the ImageObserver object to be notified as the image is being prepared.
o
)

Implements abstract java.awt.Toolkit.checkImage.

Indicates the construction status of a specified image that is being prepared for display.
private static void
private static void
private int
public static native void
closeSplashScreen()

Locates the splash screen library in a platform dependent way and closes the splash screen.

public static synchronized void
public Image
createImage(String
the name of a file containing pixel data in a recognized file format.
filename
)

Implements abstract java.awt.Toolkit.createImage.

Returns an image which gets pixel data from the specified file.
public Image
createImage(URL
the URL to use in fetching the pixel data.
url
)

Implements abstract java.awt.Toolkit.createImage.

Returns an image which gets pixel data from the specified URL.
public Image
createImage(byte[]
an array of bytes, representing image data in a supported image format.
data
,
int
the offset of the beginning of the data in the array.
offset
,
int
the length of the data in the array.
length
)

Implements abstract java.awt.Toolkit.createImage.

Creates an image which decodes the image stored in the specified byte array, and at the specified offset and length.
public Image
createImage(ImageProducer
the image producer to be used.
producer
)

Implements abstract java.awt.Toolkit.createImage.

Creates an image with the specified image producer.
public static Image
createImageWithResolutionVariant(Image image, Image resolutionVariant)

public Window
public abstract FramePeer
public static AppContext
pack-priv static final AppContext
public abstract SystemTrayPeer
public abstract TrayIconPeer
public void
disableBackgroundErase(Canvas canvas)

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

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.

private void
public void
public void
protected static void
public boolean
enableInputMethodsForTextComponent()

Implements sun.awt.InputMethodSupport.enableInputMethodsForTextComponent.

Returns whether enableInputMethods should be set to true for peered TextComponent instances on this platform.
public static void
public static void
public static void
executeOnEventHandlerThread(Object target, Runnable runnable, final long when)

public static void
private void
public static void
public static void
private static AppContext
getAppContext(Object target)

Returns the appContext field for target.

public ColorModel
getColorModel()

Implements abstract java.awt.Toolkit.getColorModel.

Determines the color model of this toolkit's screen.
public static Window

Returns:

Window ancestor of the component or component by itself if it is Window; null, if component is not a part of window hierarchy
getContainingWindow
(Component comp)

Returns the Window ancestor of the component comp.

public Locale
getDefaultKeyboardLocale()

Implements sun.awt.InputMethodSupport.getDefaultKeyboardLocale.

Returns the default keyboard locale of the underlying operating system
public String
protected RenderingHints
private static RenderingHints
public static RenderingHints
public int
getFocusAcceleratorKeyMask()

Returns key modifiers used by Swing to set up a focus accelerator key stroke.

public String[]
getFontList()

Implements abstract java.awt.Toolkit.getFontList.

Returns the names of the available fonts in this toolkit.
public FontMetrics
getFontMetrics(Font
a font
font
)

Implements abstract java.awt.Toolkit.getFontMetrics.

Gets the screen device metrics for rendering of the font.
public static Component
getHeavyweightComponent(Component c)

Gives native peers the ability to query the closest HW component.

public Image
getImage(String
the name of a file containing pixel data in a recognized file format.
filename
)

Implements abstract java.awt.Toolkit.getImage.

Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG.
public Image
getImage(URL
the URL to use in fetching the pixel data.
url
)

Implements abstract java.awt.Toolkit.getImage.

Returns an image which gets pixel data from the specified URL.
pack-priv static Image
pack-priv static Image
protected Image
getImageWithResolutionVariant(String fileName, String resolutionVariantName)

protected Image
getImageWithResolutionVariant(URL url, URL resolutionVariantURL)

public abstract KeyboardFocusManagerPeer
getKeyboardFocusManagerPeer()

Redeclares sun.awt.KeyboardFocusManagerPeerProvider.getKeyboardFocusManagerPeer.

Gets a singleton KeyboardFocusManagerPeer instance.
protected static LightweightFrame
public static Container
getNativeContainer(Component
the component to fetch the container for
c
)

Hides java.awt.Toolkit.getNativeContainer.

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.

private static ToolkitImage
private static int
getRVSize(int size)

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.

public Dimension
getScreenSize()

Implements abstract java.awt.Toolkit.getScreenSize.

Gets the size of the screen.
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.

public static boolean
getSunAwtErasebackgroundonresize()

Returns the value of "sun.awt.erasebackgroundonresize" property.

public static boolean
getSunAwtNoerasebackground()

Returns the value of "sun.awt.noerasebackground" property.

protected EventQueue
getSystemEventQueueImpl()

Implements abstract java.awt.Toolkit.getSystemEventQueueImpl.

Gets the application's or applet's EventQueue instance, without checking access.
pack-priv static EventQueue
public static EventQueue
public synchronized long
public abstract void
grab(Window w)

Grabs the mouse input for the given window.

protected static boolean
imageCached(String fileName)

protected static boolean
protected static boolean
imageExists(String filename)

protected static boolean
private static void
initEQ(AppContext
AppContext to associate with the event queue
appContext
)

Creates and initializes EventQueue instance for the specified AppContext.

private static void
public static void
public static void
public static final boolean
public static boolean

Returns:

true if the passed component is not null and has a containing toplevel window which is opaque (so per-pixel translucency is not enabled), false otherwise
isContainingTopLevelOpaque
(Component
a Component which toplevel's to check
c
)

Returns whether or not a containing top level window for the passed component is PERPIXEL_TRANSLUCENT.

public static boolean

Returns:

true if the passed component is not null and has a containing toplevel window which has opacity less than 1.0f (which means that it is translucent), false otherwise
isContainingTopLevelTranslucent
(Component
a Component which toplevel's to check
c
)

Returns whether or not a containing top level window for the passed component is TRANSLUCENT.

public abstract boolean
public static boolean
private boolean
public static boolean

Returns:

true, if this object implements/extends the given interface/class, false, otherwise, or if obj or type is null
isInstanceOf
(Object
Object to be checked
obj
,
String
The name of the interface/class. Must be fully-qualified interface/class name.
type
)

Checks that the given object implements/extends the given interface/class.

private static boolean
isInstanceOf(Class<?> cls, String type)

public static boolean
public static boolean
public static boolean

Returns:

true if modal exclusion is supported by the toolkit, false otherwise
isModalExcludedSupported
()

Returns whether the modal exclusion API is supported by the current toolkit.

protected boolean
public boolean
isModalExclusionTypeSupported(Dialog.ModalExclusionType
modal exclusion type to be checked for support by this toolkit
exclusionType
)

Implements abstract java.awt.Toolkit.isModalExclusionTypeSupported.

Overridden in XToolkit and WToolkit
public boolean
isModalityTypeSupported(Dialog.ModalityType
modality type to be checked for support by this toolkit
modalityType
)

Implements abstract java.awt.Toolkit.isModalityTypeSupported.

Overridden in XToolkit and WToolkit
public boolean
isNativeGTKAvailable()

Returns true if the native GTK libraries are available.

public boolean
isPrintableCharacterModifiersMask(int mods)

Tests whether specified key modifiers mask can be used to enter a printable character.

public boolean

Returns:

true if running on Wayland, false otherwise
isRunningOnWayland
()

Checks if the system is running Linux with the Wayland server.

public boolean
isSwingBackbufferTranslucencySupported()

Returns true if swing backbuffer should be translucent.

public static boolean
public abstract boolean
public static boolean
public boolean
public abstract boolean
public boolean
public boolean
public boolean
protected final boolean
isXEmbedServerRequested()

Returns whether the XEmbed server feature is requested by developer.

public static boolean

Returns:

true, if XEmbed is needed, false otherwise
needsXEmbed
()

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

protected boolean

Returns:

true, if XEmbed is needed, false otherwise
needsXEmbedImpl
()

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

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.

pack-priv final void
notifyModalityChange(int id, Dialog source)

public void
public void
public static void
postEvent(AppContext appContext, AWTEvent event)

public static void
public boolean
prepareImage(Image
the image for which to prepare a screen representation.
img
,
int
the width of the desired screen representation, or -1.
w
,
int
the height of the desired screen representation, or -1.
h
,
ImageObserver
the ImageObserver object to be notified as the image is being prepared.
o
)

Implements abstract java.awt.Toolkit.prepareImage.

Prepares an image for rendering.
private boolean
public void
realSync()

Parameterless version of realSync(long) which uses the default timeout of DEFAULT_WAIT_TIME.

public void
realSync(final long
the maximum time to wait in milliseconds, negative means "forever".
timeout
)

Forces toolkit to synchronize with the native windowing sub-system, flushing all pending work and waiting for all the events to be processed.

public void
public static void
setAAFontSettingsCondition(boolean extraCondition)

private static boolean
setAppContext(Object target, AppContext context)

Sets the appContext field of target.

public static void
setLWRequestStatus(Window
the window for which the lightweight focus request status should be set
changed
,
boolean
the value of lightweight focus request status
status
)

Sets the synchronous status of focus requests on lightweight components in the specified window to the specified value.

public static void
public static void
public synchronized void
public void
protected abstract boolean
syncNativeQueue(long timeout)

Platform toolkits need to implement this method to perform the sync of the native queue.

protected static void
protected static void
public static AppContext
protected static Object
protected long
timeout(long end)

public abstract void
ungrab(Window w)

Forces ungrab.

public void
public boolean
private static boolean
private final boolean
waitForIdle(final long end)

Waits for the Java event queue to empty.

pack-priv static void
wakeupEventQueue(EventQueue q, boolean isShutdown)

Inherited from java.awt.Toolkit:
addAWTEventListeneraddPropertyChangeListenerareExtraMouseButtonsEnabledbeepcreateCustomCursorcreateDragGestureRecognizercreateImagegetAWTEventListenersgetAWTEventListenersgetBestCursorSizegetDefaultToolkitgetDesktopPropertygetLockingKeyStategetMaximumCursorColorsgetMenuShortcutKeyMaskgetMenuShortcutKeyMaskExgetPrintJobgetPrintJobgetPropertygetPropertyChangeListenersgetPropertyChangeListenersgetScreenInsetsgetScreenResolutiongetSystemClipboardgetSystemEventQueuegetSystemSelectioninitializeDesktopPropertiesisAlwaysOnTopSupportedisDynamicLayoutActiveisDynamicLayoutSetisFrameStateSupportedlazilyLoadDesktopPropertyloadSystemColorsmapInputMethodHighlightremoveAWTEventListenerremovePropertyChangeListenersetDesktopPropertysetDynamicLayoutsetLockingKeyStatesync