is new.
java.lang.Objectjava.awt.Toolkit
public abstract class Toolkit
This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit. Subclasses of Toolkit are used to bind the various components to particular native toolkit implementations.
Many GUI operations may be performed asynchronously. This means that if you set the state of a component, and then immediately query the state, the returned value may not yet reflect the requested change. This includes, but is not limited to:
Most applications should not call any of the methods in this class directly. The methods defined by Toolkit are the "glue" that joins the platform-independent classes in the java.awt package with their counterparts in java.awt.peer. Some methods defined by Toolkit query the native operating system directly.
| Field Summary | |
|---|---|
| protected Map < String , Object > |
desktopProperties
|
| protected PropertyChangeSupport |
desktopPropsSupport
|
| Constructor Summary | |
|---|---|
|
Toolkit
() |
|
| Method Summary | ||
|---|---|---|
| void |
addAWTEventListener
(
AWTEventListener
listener, long eventMask) Adds an AWTEventListener to receive all AWTEvents dispatched system-wide that conform to the given eventMask. |
|
| void |
addPropertyChangeListener
(
String
name,
PropertyChangeListener
pcl) Adds the specified property change listener for the named desktop property. |
|
| abstract void |
beep
() Emits an audio beep. |
|
| abstract int |
checkImage
(
Image
image, int width, int height,
ImageObserver
observer) Indicates the construction status of a specified image that is being prepared for display. |
|
| protected abstract java.awt.peer.ButtonPeer |
createButton
(
Button
target) Creates this toolkit's implementation of Button using the specified peer interface. |
|
| protected abstract java.awt.peer.CanvasPeer |
createCanvas
(
Canvas
target) Creates this toolkit's implementation of Canvas using the specified peer interface. |
|
| protected abstract java.awt.peer.CheckboxPeer |
createCheckbox
(
Checkbox
target) Creates this toolkit's implementation of Checkbox using the specified peer interface. |
|
| protected abstract java.awt.peer.CheckboxMenuItemPeer |
createCheckboxMenuItem
(
CheckboxMenuItem
target) Creates this toolkit's implementation of CheckboxMenuItem using the specified peer interface. |
|
| protected abstract java.awt.peer.ChoicePeer |
createChoice
(
Choice
target) Creates this toolkit's implementation of Choice using the specified peer interface. |
|
| protected java.awt.peer.LightweightPeer |
createComponent
(
Component
target) Creates a peer for a component or container. |
|
| Cursor |
createCustomCursor
(
Image
cursor,
Point
hotSpot,
String
name) Creates a new custom cursor object. |
|
protected abstract java.awt.peer.DesktopPeer
|
createDesktopPeer
(
Desktop
Creates this toolkit's implementation of the Desktop using the specified peer interface.
|
|
| protected abstract java.awt.peer.DialogPeer |
createDialog
(
Dialog
target) Creates this toolkit's implementation of Dialog using the specified peer interface. |
|
|
createDragGestureRecognizer
(
Class
<T> abstractRecognizerClass,
DragSource
ds,
Component
c, int srcActions,
DragGestureListener
dgl) Creates a concrete, platform dependent, subclass of the abstract DragGestureRecognizer class requested, and associates it with the DragSource, Component and DragGestureListener specified. |
|
| abstract java.awt.dnd.peer.DragSourceContextPeer |
createDragSourceContextPeer
(
DragGestureEvent
dge) Creates the peer for a DragSourceContext. |
|
| protected abstract java.awt.peer.FileDialogPeer |
createFileDialog
(
FileDialog
target) Creates this toolkit's implementation of FileDialog using the specified peer interface. |
|
| protected abstract java.awt.peer.FramePeer |
createFrame
(
Frame
target) Creates this toolkit's implementation of Frame using the specified peer interface. |
|
| Image |
createImage
(byte[] imagedata) Creates an image which decodes the image stored in the specified byte array. |
|
| abstract Image |
createImage
(byte[] imagedata, int imageoffset, int imagelength) Creates an image which decodes the image stored in the specified byte array, and at the specified offset and length. |
|
| abstract Image |
createImage
(
ImageProducer
producer) Creates an image with the specified image producer. |
|
| abstract Image |
createImage
(
String
filename) Returns an image which gets pixel data from the specified file. |
|
| abstract Image |
createImage
(
URL
url) Returns an image which gets pixel data from the specified URL. |
|
| protected abstract java.awt.peer.LabelPeer |
createLabel
(
Label
target) Creates this toolkit's implementation of Label using the specified peer interface. |
|
| protected abstract java.awt.peer.ListPeer |
createList
(
List
target) Creates this toolkit's implementation of List using the specified peer interface. |
|
| protected abstract java.awt.peer.MenuPeer |
createMenu
(
Menu
target) Creates this toolkit's implementation of Menu using the specified peer interface. |
|
| protected abstract java.awt.peer.MenuBarPeer |
createMenuBar
(
MenuBar
target) Creates this toolkit's implementation of MenuBar using the specified peer interface. |
|
| protected abstract java.awt.peer.MenuItemPeer |
createMenuItem
(
MenuItem
target) Creates this toolkit's implementation of MenuItem using the specified peer interface. |
|
| protected abstract java.awt.peer.PanelPeer |
createPanel
(
Panel
target) Creates this toolkit's implementation of Panel using the specified peer interface. |
|
| protected abstract java.awt.peer.PopupMenuPeer |
createPopupMenu
(
PopupMenu
target) Creates this toolkit's implementation of PopupMenu using the specified peer interface. |
|
| protected abstract java.awt.peer.ScrollbarPeer |
createScrollbar
(
Scrollbar
target) Creates this toolkit's implementation of Scrollbar using the specified peer interface. |
|
| protected abstract java.awt.peer.ScrollPanePeer |
createScrollPane
(
ScrollPane
target) Creates this toolkit's implementation of ScrollPane using the specified peer interface. |
|
| protected abstract java.awt.peer.TextAreaPeer |
createTextArea
(
TextArea
target) Creates this toolkit's implementation of TextArea using the specified peer interface. |
|
| protected abstract java.awt.peer.TextFieldPeer |
createTextField
(
TextField
target) Creates this toolkit's implementation of TextField using the specified peer interface. |
|
| protected abstract java.awt.peer.WindowPeer |
createWindow
(
Window
target) Creates this toolkit's implementation of Window using the specified peer interface. |
|
| AWTEventListener [] |
getAWTEventListeners
() Returns an array of all the AWTEventListeners registered on this toolkit. |
|
| AWTEventListener |
getAWTEventListeners
(long eventMask) Returns an array of all the AWTEventListeners registered on this toolkit which listen to all of the event types
specified
|
|
| Dimension |
getBestCursorSize
(int preferredWidth, int preferredHeight) Returns the supported cursor dimension which is closest to the desired sizes. |
|
| abstract ColorModel |
getColorModel
() Determines the color model of this toolkit's screen. |
|
| static Toolkit |
getDefaultToolkit
() Gets the default toolkit. |
|
| Object |
getDesktopProperty
(
String
propertyName) Obtains a value for the specified desktop property. |
|
| abstract String [] |
getFontList
() Deprecated. see GraphicsEnvironment.getAvailableFontFamilyNames() |
|
| abstract FontMetrics |
getFontMetrics
(
Font
font) Deprecated. As of JDK version 1.2, replaced by the Font method getLineMetrics. |
|
| protected abstract java.awt.peer.FontPeer |
getFontPeer
(
String
name, int style) Deprecated. see java.awt.GraphicsEnvironment#getAllFonts |
|
| abstract Image |
getImage
(
String
filename) Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG. |
|
| abstract Image |
getImage
(
URL
url) Returns an image which gets pixel data from the specified URL. |
|
| boolean |
getLockingKeyState
(int keyCode) Returns whether the given locking key on the keyboard is currently in its "on" state. |
|
| int |
getMaximumCursorColors
() Returns the maximum number of colors the Toolkit supports in a custom cursor palette. |
|
| int |
getMenuShortcutKeyMask
() Determines which modifier key is the appropriate accelerator key for menu shortcuts. |
|
| protected java.awt.peer.MouseInfoPeer |
getMouseInfoPeer
() Obtains this toolkit's implementation of helper class for MouseInfo operations. |
|
| protected 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). |
|
| PrintJob |
getPrintJob
(
Frame
frame,
String
jobtitle,
JobAttributes
jobAttributes,
PageAttributes
pageAttributes) Gets a PrintJob object which is the result of initiating a print operation on the toolkit's platform. |
|
| abstract PrintJob |
getPrintJob
(
Frame
frame,
String
jobtitle,
Properties
props) Gets a PrintJob object which is the result of initiating a print operation on the toolkit's platform. |
|
| static String |
getProperty
(
String
key,
String
defaultValue) Gets a property with the specified key and default. |
|
| PropertyChangeListener [] |
getPropertyChangeListeners
() Returns an array of all the property change listeners registered on this toolkit. |
|
| PropertyChangeListener [] |
getPropertyChangeListeners
(
String
propertyName) Returns an array of all the PropertyChangeListeners associated with the named property. |
|
| Insets |
getScreenInsets
(
GraphicsConfiguration
gc) Gets the insets of the screen. |
|
| abstract int |
getScreenResolution
() Returns the screen resolution in dots-per-inch. |
|
| abstract Dimension |
getScreenSize
() Gets the size of the screen. |
|
| abstract Clipboard |
getSystemClipboard
() Gets the singleton instance of the system Clipboard which interfaces with clipboard facilities provided by the native platform. |
|
| EventQueue |
getSystemEventQueue
() Get the application's or applet's EventQueue instance. |
|
| protected abstract EventQueue |
getSystemEventQueueImpl
() Gets the application's or applet's EventQueue instance, without checking access. |
|
| Clipboard |
getSystemSelection
() Gets the singleton instance of the system selection as a Clipboard object. |
|
| protected void |
initializeDesktopProperties
() initializeDesktopProperties |
|
boolean
|
isAlwaysOnTopSupported
()
Returns whether the always-on-top mode is supported by this toolkit.
|
|
| boolean |
isDynamicLayoutActive
() Returns whether dynamic layout of Containers on resize is currently active (both set programmatically, and supported by the underlying operating system and/or window manager). |
|
| protected boolean |
isDynamicLayoutSet
() Returns whether the layout of Containers is validated dynamically during resizing, or statically, after resizing is complete. |
|
| boolean |
isFrameStateSupported
(int state) Returns whether Toolkit supports this state for Frames. |
|
abstract boolean
|
isModalExclusionTypeSupported
(
Dialog.ModalExclusionType
Returns whether the given modal exclusion type is supported by this toolkit.
|
|
abstract boolean
|
isModalityTypeSupported
(
Dialog.ModalityType
Returns whether the given modality type is supported by this toolkit.
|
|
| protected Object |
lazilyLoadDesktopProperty
(
String
name) an opportunity to lazily evaluate desktop property values. |
|
| protected void |
loadSystemColors
(int[] systemColors) Fills in the integer array that is supplied as an argument with the current system color values. |
|
| abstract Map < TextAttribute ,?> |
mapInputMethodHighlight
(
InputMethodHighlight
highlight) Returns a map of visual attributes for the abstract level description of the given input method highlight, or null if no mapping is found. |
|
| abstract boolean |
prepareImage
(
Image
image, int width, int height,
ImageObserver
observer) Prepares an image for rendering. |
|
| void |
removeAWTEventListener
(
AWTEventListener
listener) Removes an AWTEventListener from receiving dispatched AWTEvents. |
|
| void |
removePropertyChangeListener
(
String
name,
PropertyChangeListener
pcl) Removes the specified property change listener for the named desktop property. |
|
| protected void |
setDesktopProperty
(
String
name,
Object
newValue) Sets the named desktop property to the specified value and fires a property change event to notify any listeners that the value has changed. |
|
| void |
setDynamicLayout
(boolean dynamic) Controls whether the layout of Containers is validated dynamically during resizing, or statically, after resizing is complete. |
|
| void |
setLockingKeyState
(int keyCode, boolean on) Sets the state of the given locking key on the keyboard. |
|
| abstract void |
sync
() Synchronizes this toolkit's graphics state. |
|
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| Field Detail |
|---|
protected final Map<String,Object> desktopProperties
protected final PropertyChangeSupport desktopPropsSupport
| Constructor Detail |
|---|
public Toolkit()
| Method Detail |
|---|
createDesktopPeer
protected abstract java.awt.peer.DesktopPeer
createDesktopPeer
(
Desktop
target) throws
HeadlessException
Creates this toolkit's implementation of the Desktop using the specified peer interface.
Parameters:
target - the desktop to be implemented
Returns:
this toolkit's implementation of the Desktop
Throws:
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true
See Also:
GraphicsEnvironment.isHeadless()
,
Desktop
, DesktopPeer
protected abstract java.awt.peer.ButtonPeer createButton(Button target)
throws HeadlessException
protected abstract java.awt.peer.TextFieldPeer createTextField(TextField target)
throws HeadlessException
protected abstract java.awt.peer.LabelPeer createLabel(Label target)
throws HeadlessException
protected abstract java.awt.peer.ListPeer createList(List target)
throws HeadlessException
protected abstract java.awt.peer.CheckboxPeer createCheckbox(Checkbox target)
throws HeadlessException
protected abstract java.awt.peer.ScrollbarPeer createScrollbar(Scrollbar target)
throws HeadlessException
protected abstract java.awt.peer.ScrollPanePeer createScrollPane(ScrollPane target)
throws HeadlessException
protected abstract java.awt.peer.TextAreaPeer createTextArea(TextArea target)
throws HeadlessException
protected abstract java.awt.peer.ChoicePeer createChoice(Choice target)
throws HeadlessException
protected abstract java.awt.peer.FramePeer createFrame(Frame target)
throws HeadlessException
protected abstract java.awt.peer.CanvasPeer createCanvas(Canvas target)
protected abstract java.awt.peer.PanelPeer createPanel(Panel target)
protected abstract java.awt.peer.WindowPeer createWindow(Window target)
throws HeadlessException
protected abstract java.awt.peer.DialogPeer createDialog(Dialog target)
throws HeadlessException
protected abstract java.awt.peer.MenuBarPeer createMenuBar(MenuBar target)
throws HeadlessException
protected abstract java.awt.peer.MenuPeer createMenu(Menu target)
throws HeadlessException
protected abstract java.awt.peer.PopupMenuPeer createPopupMenu(PopupMenu target)
throws HeadlessException
protected abstract java.awt.peer.MenuItemPeer createMenuItem(MenuItem target)
throws HeadlessException
protected abstract java.awt.peer.FileDialogPeer createFileDialog(FileDialog target)
throws HeadlessException
protected abstract java.awt.peer.CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
throws HeadlessException
protected java.awt.peer.MouseInfoPeer getMouseInfoPeer()
protected java.awt.peer.LightweightPeer createComponent(Component target)
@Deprecated
protected abstract java.awt.peer.FontPeer getFontPeer(String name,
int style)
protected void loadSystemColors(int[] systemColors)
throws HeadlessException
public void setDynamicLayout(boolean dynamic)
throws HeadlessException
protected boolean isDynamicLayoutSet()
throws HeadlessException
public boolean isDynamicLayoutActive()
throws HeadlessException
public abstract Dimension getScreenSize()
throws HeadlessException
public abstract int getScreenResolution()
throws HeadlessException
public Insets getScreenInsets(GraphicsConfiguration gc)
throws HeadlessException
public abstract ColorModel getColorModel()
throws HeadlessException
ColorModel is an abstract class that encapsulates the ability to translate between the pixel values of an image and its red, green, blue, and alpha components.
This toolkit method is called by the getColorModel method of the Component class.
@Deprecated public abstract String[] getFontList()
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.
@Deprecated public abstract FontMetrics getFontMetrics(Font font)
public abstract void sync()
This method ensures that the display is up-to-date. It is useful for animation.
public static Toolkit getDefaultToolkit()
If a system property named "java.awt.headless" is set to true then the headless implementation of Toolkit is used.
If there is a system property named "awt.toolkit", that property is treated as the name of a class that is a subclass of Toolkit.
If there is no "java.awt.headless" or it is set to false and there is a system property named "awt.toolkit", that property is treated as the name of a class that is a subclass of Toolkit; otherwise the default platform-specific implementation of Toolkit is used.
If the system property does not exist, then the default toolkit used is the class named "sun.awt.motif.MToolkit", which is a motif implementation of the Abstract Window Toolkit.
Also loads additional classes into the VM, using the property 'assistive_technologies' specified in the Sun reference implementation by a line in the 'accessibility.properties' file. The form is "assistive_technologies=..." where the "..." is a comma-separated list of assistive technology classes to load. Each class is loaded in the order given and a single instance of each is created using Class.forName(class).newInstance(). This is done just after the AWT toolkit is created. All errors are handled via an AWTError exception.
public abstract Image getImage(String filename)
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.
Throws:
SecurityException
- if a security manager exists and its checkRead method doesn't allow the operation.
public abstract Image getImage(URL url)
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.
Throws:
SecurityException
- if a security manager exists and its checkPermission method doesn't allow the operation.
public abstract Image createImage(String filename)
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.
Throws:
SecurityException
- if a security manager exists and its checkRead method doesn't allow the operation.
public abstract Image createImage(URL url)
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.
Throws:
SecurityException
- if a security manager exists and its checkPermission method doesn't allow the operation.
public abstract boolean prepareImage(Image image,
int width,
int height,
ImageObserver observer)
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.
public abstract int checkImage(Image image,
int width,
int height,
ImageObserver observer)
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.
public abstract Image createImage(ImageProducer producer)
public Image createImage(byte[] imagedata)
The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.
public abstract Image createImage(byte[] imagedata,
int imageoffset,
int imagelength)
public abstract PrintJob getPrintJob(Frame frame,
String jobtitle,
Properties props)
Each actual implementation of this method should first check if there is a security manager installed. If there is, the method should call the security manager's checkPrintJobAccess method to ensure initiation of a print operation is allowed. If the default implementation of checkPrintJobAccess is used (that is, that method is not overriden), then this results in a call to the security manager's checkPermission method with a RuntimePermission("queuePrintJob") permission.
public PrintJob getPrintJob(Frame frame,
String jobtitle,
JobAttributes jobAttributes,
PageAttributes pageAttributes)
Each actual implementation of this method should first check if there is a security manager installed. If there is, the method should call the security manager's checkPrintJobAccess method to ensure initiation of a print operation is allowed. If the default implementation of checkPrintJobAccess is used (that is, that method is not overriden), then this results in a call to the security manager's checkPermission method with a RuntimePermission("queuePrintJob") permission.
- if pageAttributes specifies differing cross feed and feed resolutions. Also if this thread has access to the file system and jobAttributes specifies print to file, and the specified destination file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason. However in the case of print to file, if a dialog is also requested to be displayed then the user will be given an opportunity to select a file and proceed with printing. The dialog will ensure that the selected output file is valid before returning from this method.
This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
- if pageAttributes specifies differing cross feed and feed resolutions. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
public abstract void beep()
public abstract Clipboard getSystemClipboard()
throws HeadlessException
In addition to any and all formats specified in the flavormap.properties file, or other file specified by the AWT.DnD.flavorMapFileURL Toolkit property, text returned by the system Clipboard's getTransferData() method is available in the following flavors:
Each actual implementation of this method should first check if there is a security manager installed. If there is, the method should call the security manager's checkSystemClipboardAccess method to ensure it's ok to to access the system clipboard. If the default implementation of checkSystemClipboardAccess is used (that is, that method is not overriden), then this results in a call to the security manager's checkPermission method with an AWTPermission("accessClipboard") permission.
public Clipboard getSystemSelection()
throws HeadlessException
An application is responsible for updating the system selection whenever the user selects text, using either the mouse or the keyboard. Typically, this is implemented by installing a FocusListener on all Components which support text selection, and, between FOCUS_GAINED and FOCUS_LOST events delivered to that Component, updating the system selection Clipboard when the selection changes inside the Component. Properly updating the system selection ensures that a Java application will interact correctly with native applications and other Java applications running simultaneously on the system. Note that java.awt.TextComponent and javax.swing.text.JTextComponent already adhere to this policy. When using these classes, and their subclasses, developers need not write any additional code.
Some platforms do not support a system selection Clipboard. On those platforms, this method will return null. In such a case, an application is absolved from its responsibility to update the system selection Clipboard as described above.
Each actual implementation of this method should first check if there is a SecurityManager installed. If there is, the method should call the SecurityManager's checkSystemClipboardAccess method to ensure that client code has access the system selection. If the default implementation of checkSystemClipboardAccess is used (that is, if the method is not overridden), then this results in a call to the SecurityManager's checkPermission method with an AWTPermission("accessClipboard") permission.
public int getMenuShortcutKeyMask()
throws HeadlessException
Menu shortcuts, which are embodied in the MenuShortcut class, are handled by the MenuBar class.
By default, this method returns Event.CTRL_MASK. Toolkit implementations should override this method if the Control key isn't the correct key for accelerators.
public boolean getLockingKeyState(int keyCode)
throws UnsupportedOperationException
public void setLockingKeyState(int keyCode,
boolean on)
throws UnsupportedOperationException
Depending on the platform, setting the state of a locking key may involve event processing and therefore may not be immediately observable through getLockingKeyState.
protected static Container getNativeContainer(Component c)
public Cursor createCustomCursor(Image cursor,
Point hotSpot,
String name)
throws IndexOutOfBoundsException,
HeadlessException
Note that multi-frame images are invalid and may cause this method to hang.
public Dimension getBestCursorSize(int preferredWidth,
int preferredHeight)
throws HeadlessException
Note: if an image is used whose dimensions don't match a supported size (as returned by this method), the Toolkit implementation will attempt to resize the image to a supported size. Since converting low-resolution images is difficult, no guarantees are made as to the quality of a cursor image which isn't a supported size. It is therefore recommended that this method be called and an appropriate image used so no image conversion is made.
public int getMaximumCursorColors()
throws HeadlessException
Note: if an image is used which has more colors in its palette than the supported maximum, the Toolkit implementation will attempt to flatten the palette to the maximum. Since converting low-resolution images is difficult, no guarantees are made as to the quality of a cursor image which has more colors than the system supports. It is therefore recommended that this method be called and an appropriate image used so no image conversion is made.
public boolean isFrameStateSupported(int state)
throws HeadlessException
public static String getProperty(String key,
String defaultValue)
public final EventQueue getSystemEventQueue()
First, if there is a security manager, its checkAwtEventQueueAccess method is called. If the default implementation of checkAwtEventQueueAccess is used (that is, that method is not overriden), then this results in a call to the security manager's checkPermission method with an AWTPermission("accessEventQueue") permission.
protected abstract EventQueue getSystemEventQueueImpl()
public abstract java.awt.dnd.peer.DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
throws InvalidDnDOperationException
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(Class<T> abstractRecognizerClass,
DragSource ds,
Component c,
int srcActions,
DragGestureListener dgl)
public final Object getDesktopProperty(String propertyName)
For more information on desktop properties supported by the AWT see
AWT Desktop Properties
.
protected final void setDesktopProperty(String name,
Object newValue)
protected Object lazilyLoadDesktopProperty(String name)
protected void initializeDesktopProperties()
public void addPropertyChangeListener(String name,
PropertyChangeListener pcl)
public void removePropertyChangeListener(String name,
PropertyChangeListener pcl)
public PropertyChangeListener[] getPropertyChangeListeners()
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
isAlwaysOnTopSupported
public boolean
isAlwaysOnTopSupported
()
Returns whether the always-on-top mode is supported by this toolkit. To detect whether the always-on-top mode is supported for a particular Window, use
Window.isAlwaysOnTopSupported()
.
Returns:
true, if current toolkit supports the always-on-top mode, otherwise returns false
Since:
1.6
See Also:
Window.isAlwaysOnTopSupported()
,
Window.setAlwaysOnTop(boolean)
isModalityTypeSupported
public abstract boolean
isModalityTypeSupported
(
Dialog.ModalityType
modalityType)
Returns whether the given modality type is supported by this toolkit. If a dialog with unsupported modality type is created, then Dialog.ModalityType.MODELESS is used instead.
Parameters:
modalityType - modality type to be checked for support by this toolkit
Returns:
true, if current toolkit supports given modality type, false otherwise
Since:
1.6
See Also:
Dialog.ModalityType
,
Dialog.getModalityType()
,
Dialog.setModalityType(java.awt.Dialog.ModalityType)
isModalExclusionTypeSupported
public abstract boolean
isModalExclusionTypeSupported
(
Dialog.ModalExclusionType
modalExclusionType)
Returns whether the given modal exclusion type is supported by this toolkit. If an unsupported modal exclusion type property is set on a window, then Dialog.ModalExclusionType.NO_EXCLUDE is used instead.
Parameters:
modalExclusionType - modal exclusion type to be checked for support by this toolkit
Returns:
true>, if current toolkit supports given modal exclusion type, false otherwise
Since:
1.6
See Also:
Dialog.ModalExclusionType
,
Window.getModalExclusionType()
,
Window.setModalExclusionType(java.awt.Dialog.ModalExclusionType)
public void addAWTEventListener(AWTEventListener listener,
long eventMask)
First, if there is a security manager, its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.
eventMask is a bitmask of event types to receive. It is constructed by bitwise OR-ing together the event masks defined in AWTEvent.
Note: event listener use is not recommended for normal application use, but are intended solely to support special purpose facilities including support for accessibility, event record/playback, and diagnostic tracing. If listener is null, no exception is thrown and no action is performed.
public void removeAWTEventListener(AWTEventListener listener)
First, if there is a security manager, its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.
Note: event listener use is not recommended for normal application use, but are intended solely to support special purpose facilities including support for accessibility, event record/playback, and diagnostic tracing. If listener is null, no exception is thrown and no action is performed.
public AWTEventListener[] getAWTEventListeners()
If there is a security manager, its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.
Listeners can be returned within AWTEventListenerProxy objects, which also contain the event mask for the given listener. Note that listener objects added multiple times appear only once in the returned array.
public AWTEventListener[] getAWTEventListeners(long eventMask)
specified
If there is a security manager, its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.
Listeners can be returned within AWTEventListenerProxy objects, which also contain the event mask for the given listener. Note that listener objects added multiple times appear only once in the returned array.
public abstract Map<TextAttribute,?> mapInputMethodHighlight(InputMethodHighlight highlight)
throws HeadlessException