Академический Документы
Профессиональный Документы
Культура Документы
PACKAGE
CLASS
USE
TREE
FRAMES
DEPRECATED
NO FRAMES
Java Platform
Standard Ed. 8
INDEX HELP
ALL CLASSES
java.awt
Class Toolkit
java.lang.Object
java.awt.Toolkit
JDK1.0
Field Summary
Fields
Modifier and Type
protected Map<String,Object>
desktopProperties
Constructor Summary
Constructors
Constructor and Description
Toolkit()
Method Summary
All Methods
Static Methods
Instance Methods
Abstract Methods
Concrete Methods
Deprecated Methods
void
void
boolean
areExtraMouseButtonsEnabled()
Reports whether events from extra mouse buttons are allowed to be processed and posted
into EventQueue.
abstract void
beep()
Emits an audio beep depending on native system settings and hardware capabilities.
abstract int
createButton(Button target)
Creates this toolkit's implementation of Button using the specified peer interface.
createCanvas(Canvas target)
Creates this toolkit's implementation of Canvas using the specified peer interface.
createCheckbox(Checkbox target)
Creates this toolkit's implementation of Checkbox using the specified peer interface.
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
createDesktopPeer(Desktop target)
Creates this toolkit's implementation of the Desktop using the specified peer interface.
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.
createFileDialog(FileDialog target)
Creates this toolkit's implementation of FileDialog using the specified peer interface.
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
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.
createLabel(Label target)
Creates this toolkit's implementation of Label using the specified peer interface.
createList(List target)
Creates this toolkit's implementation of List using the specified peer interface.
createMenu(Menu target)
Creates this toolkit's implementation of Menu using the specified peer interface.
createMenuBar(MenuBar target)
Creates this toolkit's implementation of MenuBar using the specified peer interface.
createMenuItem(MenuItem target)
Creates this toolkit's implementation of MenuItem using the specified peer interface.
createPanel(Panel target)
Creates this toolkit's implementation of Panel using the specified peer interface.
createPopupMenu(PopupMenu target)
Creates this toolkit's implementation of PopupMenu using the specified peer interface.
createScrollbar(Scrollbar target)
Creates this toolkit's implementation of Scrollbar using the specified peer interface.
createScrollPane(ScrollPane target)
Creates this toolkit's implementation of ScrollPane using the specified peer interface.
createTextArea(TextArea target)
Creates this toolkit's implementation of TextArea using the specified peer interface.
createTextField(TextField target)
Creates this toolkit's implementation of TextField using the specified peer interface.
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 in the eventMask argument.
Dimension
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.
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.
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
abstract PrintJob
static String
PropertyChangeListener[]
getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this toolkit.
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName)
Returns an array of all property change listeners associated with the specified name of a
desktop 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.
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 in
program ( isDynamicLayoutSet() ) , 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 modalExclusionType)
Returns whether the given modal exclusion type is supported by this toolkit.
abstract boolean
isModalityTypeSupported(Dialog.ModalityType 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
void
removeAWTEventListener(AWTEventListener listener)
Removes an AWTEventListener from receiving dispatched AWTEvents.
void
protected void
void
setDynamicLayout(boolean dynamic)
Controls whether the layout of Containers is validated dynamically during resizing, or
statically, after resizing is complete.
void
abstract void
sync()
Synchronizes this toolkit's graphics state.
Field Detail
desktopProperties
desktopPropsSupport
Constructor Detail
Toolkit
public Toolkit()
Method Detail
createDesktopPeer
1.6
See Also:
createButton
createTextField
createLabel
createList
throws HeadlessException
Creates this toolkit's implementation of List using the specified peer interface.
Parameters:
createCheckbox
createScrollbar
createScrollPane
JDK1.1
See Also:
createTextArea
createChoice
createFrame
createCanvas
Canvas, CanvasPeer
createPanel
Panel, PanelPeer
createWindow
See Also:
createDialog
createMenuBar
createMenu
createPopupMenu
JDK1.1
See Also:
createMenuItem
Parameters:
createFileDialog
createCheckboxMenuItem
getMouseInfoPeer
1.5
See Also:
MouseInfoPeer, MouseInfo
createComponent
getFontPeer
@Deprecated
protected abstract java.awt.peer.FontPeer getFontPeer(String name,
int style)
Deprecated. see java.awt.GraphicsEnvironment#getAllFonts
Creates this toolkit's implementation of Font using the specified peer interface.
Parameters:
loadSystemColors
JDK1.1
See Also:
GraphicsEnvironment.isHeadless()
setDynamicLayout
dynamic - If true, Containers should re-layout their components as the Container is being resized. If false, the layout will
be validated after resizing is completed.
Throws:
1.4
See Also:
isDynamicLayoutSet
true if validation of Containers is done dynamically, false if validation is done after resizing is finished.
Throws:
1.4
See Also:
isDynamicLayoutActive
1.4
See Also:
getScreenSize
getScreenResolution
GraphicsEnvironment.isHeadless()
getScreenInsets
gc - a GraphicsConfiguration
Returns:
1.4
See Also:
GraphicsEnvironment.isHeadless()
getColorModel
getFontList
@Deprecated
public abstract String[] getFontList()
Deprecated. see GraphicsEnvironment.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:
GraphicsEnvironment.getAvailableFontFamilyNames()
getFontMetrics
@Deprecated
public abstract FontMetrics getFontMetrics(Font font)
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:
sync
getDefaultToolkit
AWTError - if a toolkit could not be found, or if one could not be accessed or instantiated.
getImage
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.
Throws:
SecurityException - if a security manager exists and its checkRead method doesn't allow the operation.
See Also:
createImage(java.lang.String)
getImage
an image which gets its pixel data from the specified URL.
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
See Also:
createImage(java.net.URL)
createImage
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.
Throws:
SecurityException - if a security manager exists and its checkRead method doesn't allow the operation.
See Also:
getImage(java.lang.String)
createImage
an image which gets its pixel data from the specified URL.
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
See Also:
getImage(java.net.URL)
prepareImage
true if the image has already been fully prepared; false otherwise.
See Also:
checkImage
the bitwise inclusive OR of the ImageObserver flags for the image data that is currently available.
See Also:
createImage
createImage
an image.
Since:
JDK1.1
createImage
an image.
Since:
JDK1.1
getPrintJob
JDK1.1
See Also:
getPrintJob
1.3
See Also:
beep
JDK1.1
getSystemClipboard
JDK1.1
See Also:
getSystemSelection
the system selection as a Clipboard, or null if the native platform does not support a system selection Clipboard
Throws:
Since:
1.4
See Also:
getMenuShortcutKeyMask
the modifier mask on the Event class that is used for menu shortcuts on this toolkit.
Throws:
JDK1.1
See Also:
getLockingKeyState
1.3
See Also:
GraphicsEnvironment.isHeadless()
setLockingKeyState
1.3
See Also:
GraphicsEnvironment.isHeadless()
getNativeContainer
String name)
throws IndexOutOfBoundsException,
HeadlessException
Creates a new custom cursor object. If the image to display is invalid, the cursor will be hidden (made completely transparent), and the hotspot will be set to (0,
0).
Note that multi-frame images are invalid and may cause this method to hang.
Parameters:
IndexOutOfBoundsException - if the hotSpot values are outside the bounds of the cursor
HeadlessException - if GraphicsEnvironment.isHeadless() returns true
Since:
1.2
See Also:
GraphicsEnvironment.isHeadless()
getBestCursorSize
preferredWidth - the preferred cursor width the component would like to use.
preferredHeight - the preferred cursor height the component would like to use.
Returns:
the closest matching supported cursor size, or a dimension of 0,0 if the Toolkit implementation doesn't support custom
cursors.
Throws:
1.2
See Also:
GraphicsEnvironment.isHeadless()
getMaximumCursorColors
the maximum number of colors, or zero if custom cursors are not supported by this Toolkit implementation.
Throws:
1.2
See Also:
GraphicsEnvironment.isHeadless()
isFrameStateSupported
Note that supporting a given concept is a platform- dependent feature. Due to native limitations the Toolkit object may report a particular state as supported,
however at the same time the Toolkit object will be unable to apply the state to a given frame. This circumstance has two following consequences:
Only the return value of false for the present method actually indicates that the given state is not supported. If the method returns true the given state
may still be unsupported and/or unavailable for a particular frame.
The developer should consider examining the value of the WindowEvent.getNewState() method of the WindowEvent received through the
WindowStateListener, rather than assuming that the state given to the setExtendedState() method will be definitely applied. For more information
see the documentation for the Frame.setExtendedState(int) method.
Parameters:
true is this frame state is supported by this Toolkit implementation, false otherwise.
Throws:
1.4
See Also:
Window.addWindowStateListener(java.awt.event.WindowStateListener)
getProperty
AWTPermission
getSystemEventQueueImpl
createDragSourceContextPeer
InvalidDnDOperationException
See Also:
GraphicsEnvironment.isHeadless()
createDragGestureRecognizer
the new object or null. Always returns null if GraphicsEnvironment.isHeadless() returns true.
See Also:
GraphicsEnvironment.isHeadless()
getDesktopProperty
1.2
See Also:
PropertyChangeSupport.addPropertyChangeListener(String, PropertyChangeListener)
removePropertyChangeListener
1.2
See Also:
PropertyChangeSupport.removePropertyChangeListener(String, PropertyChangeListener)
getPropertyChangeListeners
1.4
See Also:
PropertyChangeSupport.getPropertyChangeListeners()
getPropertyChangeListeners
all of the PropertyChangeListener objects associated with the specified name of a desktop property or an empty array if no
such listeners are added
Since:
1.4
See Also:
PropertyChangeSupport.getPropertyChangeListeners(String)
isAlwaysOnTopSupported
true, if current toolkit supports the always-on-top mode, otherwise returns false
Since:
1.6
See Also:
Window.isAlwaysOnTopSupported(), Window.setAlwaysOnTop(boolean)
isModalityTypeSupported
1.6
See Also:
isModalExclusionTypeSupported
true, if current toolkit supports given modal exclusion type, false otherwise
Since:
1.6
See Also:
addAWTEventListener
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.
Parameters:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
Since:
1.2
See Also:
removeAWTEventListener(java.awt.event.AWTEventListener), getAWTEventListeners(),
SecurityManager.checkPermission(java.security.Permission), AWTEvent, AWTPermission, AWTEventListener, AWTEventListenerProxy
removeAWTEventListener
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
Since:
1.2
See Also:
getAWTEventListeners
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
Since:
1.4
See Also:
getAWTEventListeners
all of the AWTEventListeners registered on this toolkit for the specified event types, or an empty array if no such listeners
are currently registered
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
Since:
1.4
See Also:
mapInputMethodHighlight
1.3
See Also:
GraphicsEnvironment.isHeadless()
areExtraMouseButtonsEnabled
true if events from extra mouse buttons are allowed to be processed and posted; false otherwise
Throws:
1.7
See Also:
OVERVIEW
PACKAGE
CLASS
USE
TREE
FRAMES
DEPRECATED
NO FRAMES
INDEX HELP
Java Platform
Standard Ed. 8
ALL CLASSES