java.lang.Object | ||
↳ | java.awt.Toolkit | |
↳ | sun.awt.SunToolkit |
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SunToolkit.IllegalThreadException | |||||||||||
SunToolkit.InfiniteLoop | |||||||||||
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Indicates the construction status of a specified image that is
being prepared for display.
| |||||||||||
Locates the splash screen library in a platform dependent way and closes
the splash screen.
| |||||||||||
Creates this toolkit's implementation of
Button using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Canvas using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Checkbox using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
CheckboxMenuItem using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Choice using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Dialog using
the specified peer interface. | |||||||||||
Creates the peer for a DragSourceContext.
| |||||||||||
Creates this toolkit's implementation of
FileDialog using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Frame using
the specified peer interface. | |||||||||||
Creates an image which decodes the image stored in the specified
byte array, and at the specified offset and length.
| |||||||||||
Returns an image which gets pixel data from the specified file.
| |||||||||||
Creates an image with the specified image producer.
| |||||||||||
Returns an image which gets pixel data from the specified URL.
| |||||||||||
Returns a new input method window, with behavior as specified in
createInputMethodWindow(String, boolean) . | |||||||||||
Creates this toolkit's implementation of
Label using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
List using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Menu using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
MenuBar using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
MenuItem using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Panel using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
PopupMenu using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
ScrollPane using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Scrollbar using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
TextArea using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
TextField using
the specified peer interface. | |||||||||||
Creates this toolkit's implementation of
Window using
the specified peer interface. | |||||||||||
Disables erasing of background on the canvas before painting
if this is supported by the current toolkit.
| |||||||||||
Returns whether enableInputMethods should be set to true for peered
TextComponent instances on this platform.
| |||||||||||
Returns the default keyboard locale of the underlying operating system
| |||||||||||
This method is deprecated.
see
getAvailableFontFamilyNames() | |||||||||||
This method is deprecated.
As of JDK version 1.2, replaced by the
Font
method getLineMetrics . | |||||||||||
This method is deprecated.
see java.awt.GraphicsEnvironment#getAllFonts
| |||||||||||
Returns an image which gets pixel data from the specified file,
whose format can be either GIF, JPEG or PNG.
| |||||||||||
Returns an image which gets pixel data from the specified URL.
| |||||||||||
Give native peers the ability to query the native container
given a native component (eg the direct parent may be lightweight).
| |||||||||||
Scans
imageList for best-looking image of specified dimensions. | |||||||||||
Gets the size of the screen.
| |||||||||||
Returns the locale in which the runtime was started.
| |||||||||||
Returns the value of "sun.awt.erasebackgroundonresize" property.
| |||||||||||
Returns the value of "sun.awt.noerasebackground" property.
| |||||||||||
Grabs the mouse input for the given window.
| |||||||||||
Returns whether the modal exclusion API is supported by the current toolkit.
| |||||||||||
Overridden in XToolkit and WToolkit
| |||||||||||
Overridden in XToolkit and WToolkit
| |||||||||||
Returns true if the native GTK libraries are available.
| |||||||||||
Returns whether default toolkit needs the support of the xembed
from embedding host(if any).
| |||||||||||
Prepares an image for rendering.
| |||||||||||
Parameterless version of realsync which uses default timout (see DEFAUL_WAIT_TIME).
| |||||||||||
Forces toolkit to synchronize with the native windowing
sub-system, flushing all pending work and waiting for all the
events to be processed.
| |||||||||||
Sets the synchronous status of focus requests on lightweight
components in the specified window to the specified value.
| |||||||||||
Makes the window OverrideRedirect, on X11 platforms.
| |||||||||||
Forces ungrab.
| |||||||||||
Called after a WINDOW_CLOSING event gets posted to the queue.
| |||||||||||
Called before a WINDOW_CLOSING event gets posted to the queue.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Obtains this toolkit's implementation of helper class for
MouseInfo operations. | |||||||||||
Gets the application's or applet's
EventQueue
instance, without checking access. | |||||||||||
Returns whether the XEmbed server feature is requested by
developer.
| |||||||||||
Returns whether this toolkit needs the support of the xembed
from embedding host(if any).
| |||||||||||
Platform toolkits need to implement this method to perform the
sync of the native queue.
| |||||||||||
Waits for the Java event queue to empty.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
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.
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.
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. |
ImageObserver
flags for the
image data that is currently available.Locates the splash screen library in a platform dependent way and closes the splash screen. Should be invoked on first top-level frame display.
Creates this toolkit's implementation of Button
using
the specified peer interface.
target | the button to be implemented. |
---|
Button
.HeadlessException |
---|
Creates this toolkit's implementation of Canvas
using
the specified peer interface.
target | the canvas to be implemented. |
---|
Canvas
.Creates this toolkit's implementation of Checkbox
using
the specified peer interface.
target | the check box to be implemented. |
---|
Checkbox
.HeadlessException |
---|
Creates this toolkit's implementation of CheckboxMenuItem
using
the specified peer interface.
target | the checkbox menu item to be implemented. |
---|
CheckboxMenuItem
.HeadlessException |
---|
Creates this toolkit's implementation of Choice
using
the specified peer interface.
target | the choice to be implemented. |
---|
Choice
.HeadlessException |
---|
Creates this toolkit's implementation of Dialog
using
the specified peer interface.
target | the dialog to be implemented. |
---|
Dialog
.HeadlessException |
---|
Creates the peer for a DragSourceContext. Always throws InvalidDndOperationException if GraphicsEnvironment.isHeadless() returns true.
InvalidDnDOperationException |
---|
Creates this toolkit's implementation of FileDialog
using
the specified peer interface.
target | the file dialog to be implemented. |
---|
FileDialog
.HeadlessException |
---|
Creates this toolkit's implementation of Frame
using
the specified peer interface.
target | the frame to be implemented. |
---|
Frame
.HeadlessException |
---|
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.
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 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.
filename | the name of a file containing pixel data in a recognized file format. |
---|
Creates an image with the specified image producer.
producer | the image producer to be used. |
---|
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.
url | the URL to use in fetching the pixel data. |
---|
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.
HeadlessException |
---|
Creates this toolkit's implementation of Label
using
the specified peer interface.
target | the label to be implemented. |
---|
Label
.HeadlessException |
---|
Creates this toolkit's implementation of List
using
the specified peer interface.
target | the list to be implemented. |
---|
List
.HeadlessException |
---|
Creates this toolkit's implementation of Menu
using
the specified peer interface.
target | the menu to be implemented. |
---|
Menu
.HeadlessException |
---|
Creates this toolkit's implementation of MenuBar
using
the specified peer interface.
target | the menu bar to be implemented. |
---|
MenuBar
.HeadlessException |
---|
Creates this toolkit's implementation of MenuItem
using
the specified peer interface.
target | the menu item to be implemented. |
---|
MenuItem
.HeadlessException |
---|
Creates this toolkit's implementation of Panel
using
the specified peer interface.
target | the panel to be implemented. |
---|
Panel
.Creates this toolkit's implementation of PopupMenu
using
the specified peer interface.
target | the popup menu to be implemented. |
---|
PopupMenu
.HeadlessException |
---|
Creates this toolkit's implementation of ScrollPane
using
the specified peer interface.
target | the scroll pane to be implemented. |
---|
ScrollPane
.HeadlessException |
---|
Creates this toolkit's implementation of Scrollbar
using
the specified peer interface.
target | the scroll bar to be implemented. |
---|
Scrollbar
.HeadlessException |
---|
Creates this toolkit's implementation of TextArea
using
the specified peer interface.
target | the text area to be implemented. |
---|
TextArea
.HeadlessException |
---|
Creates this toolkit's implementation of TextField
using
the specified peer interface.
target | the text field to be implemented. |
---|
TextField
.HeadlessException |
---|
Creates this toolkit's implementation of Window
using
the specified peer interface.
target | the window to be implemented. |
---|
Window
.HeadlessException |
---|
Disables erasing of background on the canvas before painting if this is supported by the current toolkit.
IllegalStateException | if the canvas is not displayable |
---|
Returns whether enableInputMethods should be set to true for peered TextComponent instances on this platform. False by default.
Returns the default keyboard locale of the underlying operating system
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):
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.
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.
font | a font |
---|
This method is deprecated.
see java.awt.GraphicsEnvironment#getAllFonts
Creates this toolkit's implementation of Font
using
the specified peer interface.
name | the font to be implemented |
---|---|
style | the style of the font, such as PLAIN ,
BOLD , ITALIC , or a combination |
Font
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.
filename | the name of a file containing pixel data in a recognized file format. |
---|
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.
url | the URL to use in fetching the pixel data. |
---|
Give native peers the ability to query the native container given a native component (eg the direct parent may be lightweight).
Scans imageList
for best-looking image of specified dimensions.
Image can be scaled and/or padded with transparency.
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 value of "sun.awt.erasebackgroundonresize" property. Default
value is false
.
Returns the value of "sun.awt.noerasebackground" property. Default
value is false
.
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.
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.
Overridden in XToolkit and WToolkit
exclusionType | modal exclusion type to be checked for support by this toolkit |
---|
true
, if current toolkit supports given modal exclusion
type, false
otherwiseOverridden in XToolkit and WToolkit
modalityType | modality type to be checked for support by this toolkit |
---|
true
, if current toolkit supports given modality
type, false
otherwiseReturns true if the native GTK libraries are available. The default implementation returns false, but UNIXToolkit overrides this method to provide a more specific answer.
Returns whether default toolkit needs the support of the xembed from embedding host(if any).
true
, if XEmbed is needed, false
otherwise
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.
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. |
true
if the image has already been
fully prepared; false
otherwise.Parameterless version of realsync which uses default timout (see DEFAUL_WAIT_TIME).
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.
timeout | the maximum time to wait in milliseconds, negative means "forever". |
---|
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.
status | the value of lightweight focus request status |
---|
Makes the window OverrideRedirect, on X11 platforms. See ICCCM specification for more details about OverrideRedirect windows. Implemented in XToolkit, no-op in WToolkit.
Called after a WINDOW_CLOSING event gets posted to the queue.
event | The WINDOW_CLOSING event that has been posted. |
---|
Called before a WINDOW_CLOSING event gets posted to the queue.
event | The WINDOW_CLOSING event that will be posted. |
---|
Obtains this toolkit's implementation of helper class for
MouseInfo
operations.
MouseInfo
Gets the application's or applet's EventQueue
instance, without checking access. For security reasons,
this can only be called from a Toolkit
subclass.
EventQueue
object
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.
Returns whether this toolkit needs the support of the xembed from embedding host(if any).
true
, if XEmbed is needed, false
otherwise
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.
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.