Class java.awt.Toolkit
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.Toolkit
Object
|
+----java.awt.Toolkit
- public abstract class Toolkit
- extends Object
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.
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.
- Version:
- 1.73, 07/01/98
- Author:
- Sami Shaio, Arthur van Hoff
- Since:
- JDK1.0
-
java.awt.Toolkit()
-
-
beep()
- Emits an audio beep.
-
checkImage(Image, int, int, ImageObserver)
- Indicates the construction status of a specified image that is
being prepared for display.
-
createButton(Button)
- Creates this toolkit's implementation of
Button
using
the specified peer interface.
-
createCanvas(Canvas)
- Creates this toolkit's implementation of
Canvas
using
the specified peer interface.
-
createCheckbox(Checkbox)
- Creates this toolkit's implementation of
Checkbox
using
the specified peer interface.
-
createCheckboxMenuItem(CheckboxMenuItem)
- Creates this toolkit's implementation of
CheckboxMenuItem
using
the specified peer interface.
-
createChoice(Choice)
- Creates this toolkit's implementation of
Choice
using
the specified peer interface.
-
createComponent(Component)
- Creates a peer for a component or container.
-
createDialog(Dialog)
- Creates this toolkit's implementation of
Dialog
using
the specified peer interface.
-
createFileDialog(FileDialog)
- Creates this toolkit's implementation of
FileDialog
using
the specified peer interface.
-
createFrame(Frame)
- Creates this toolkit's implementation of
Frame
using
the specified peer interface.
-
createImage(ImageProducer)
- Creates an image with the specified image producer.
-
createImage(byte[])
- Creates an image which decodes the image stored in the specified
byte array.
-
createImage(byte[], int, int)
- Creates an image which decodes the image stored in the specified
byte array, and at the specified offset and length.
-
createLabel(Label)
- Creates this toolkit's implementation of
Label
using
the specified peer interface.
-
createList(List)
- Creates this toolkit's implementation of
List
using
the specified peer interface.
-
createMenu(Menu)
- Creates this toolkit's implementation of
Menu
using
the specified peer interface.
-
createMenuBar(MenuBar)
- Creates this toolkit's implementation of
MenuBar
using
the specified peer interface.
-
createMenuItem(MenuItem)
- Creates this toolkit's implementation of
MenuItem
using
the specified peer interface.
-
createPanel(Panel)
- Creates this toolkit's implementation of
Panel
using
the specified peer interface.
-
createPopupMenu(PopupMenu)
- Creates this toolkit's implementation of
PopupMenu
using
the specified peer interface.
-
createScrollPane(ScrollPane)
- Creates this toolkit's implementation of
ScrollPane
using
the specified peer interface.
-
createScrollbar(Scrollbar)
- Creates this toolkit's implementation of
Scrollbar
using
the specified peer interface.
-
createTextArea(TextArea)
- Creates this toolkit's implementation of
TextArea
using
the specified peer interface.
-
createTextField(TextField)
- Creates this toolkit's implementation of
TextField
using
the specified peer interface.
-
createWindow(Window)
- Creates this toolkit's implementation of
Window
using
the specified peer interface.
-
getColorModel()
- Determines the color model of this toolkit's screen.
-
getDefaultToolkit()
- Gets the default toolkit.
-
getFontList()
- 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 font is also deprecated in 1.1, but only as a
separate fontname.
-
getFontMetrics(Font)
- Gets the screen metrics of the font.
-
getFontPeer(String, int)
- Creates this toolkit's implementation of
Font
using
the specified peer interface.
-
getImage(String)
- Returns an image which gets pixel data from the specified file.
-
getImage(URL)
- Returns an image which gets pixel data from the specified URL.
-
getMenuShortcutKeyMask()
- Determines which modifier key is the appropriate accelerator
key for menu shortcuts.
-
getNativeContainer(Component)
- Give native peers the ability to query the native container
given a native component (eg the direct parent may be lightweight).
-
getPrintJob(Frame, String, Properties)
- Gets a
PrintJob
object which is the result
of initiating a print operation on the toolkit's platform.
-
getProperty(String, String)
- Gets a property with the specified key and default.
-
getScreenResolution()
- Returns the screen resolution in dots-per-inch.
-
getScreenSize()
- Gets the size of the screen.
-
getSystemClipboard()
- Gets an instance of the system clipboard which interfaces
with clipboard facilities provided by the native platform.
-
getSystemEventQueue()
- Get the application's or applet's EventQueue instance.
-
getSystemEventQueueImpl()
-
-
loadSystemColors(int[])
- Fills in the integer array that is supplied as an argument
with the current system color values.
-
prepareImage(Image, int, int, ImageObserver)
- Prepares an image for rendering.
-
sync()
- Synchronizes this toolkit's graphics state.
Toolkit
public Toolkit()
beep
public abstract void beep()
- Emits an audio beep.
- Since:
- JDK1.1
checkImage
public 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.
If the values of the width and height arguments are both
-1
, this method returns the construction status of
a screen representation of the specified image in this toolkit.
Otherwise, this method returns the construction status of a
scaled representation of the image at the specified width
and height.
This method does not cause the image to begin loading.
An application must call prepareImage
to force
the loading of an image.
This method is called by the component's checkImage
methods.
Information on the flags returned by this method can be found
with the definition of the ImageObserver
interface.
- Parameters:
- image - the image whose status is being checked.
- width - the width of the scaled version whose status is
being checked, or
-1
.
- height - the height of the scaled version whose status
is being checked, or
-1
.
- observer - the
ImageObserver
object to be
notified as the image is being prepared.
- Returns:
- the bitwise inclusive OR of the
ImageObserver
flags for the
image data that is currently available.
- Since:
- JDK1.0
- See Also:
- prepareImage(java.awt.Image,
int, int, java.awt.image.ImageObserver), checkImage(java.awt.Image,
java.awt.image.ImageObserver), checkImage(java.awt.Image,
int, int, java.awt.image.ImageObserver), ImageObserver
createButton
protected abstract java.awt.peer.ButtonPeer createButton(Button target)
- Creates this toolkit's implementation of
Button
using
the specified peer interface.
- Parameters:
- target - the button to be implemented.
- Returns:
- this toolkit's implementation of
Button
.
- Since:
- JDK1.0
- See Also:
- Button, ButtonPeer
createCanvas
protected abstract java.awt.peer.CanvasPeer createCanvas(Canvas target)
- Creates this toolkit's implementation of
Canvas
using
the specified peer interface.
- Parameters:
- target - the canvas to be implemented.
- Returns:
- this toolkit's implementation of
Canvas
.
- Since:
- JDK1.0
- See Also:
- Canvas, CanvasPeer
createCheckbox
protected abstract java.awt.peer.CheckboxPeer createCheckbox(Checkbox target)
- Creates this toolkit's implementation of
Checkbox
using
the specified peer interface.
- Parameters:
- target - the check box to be implemented.
- Returns:
- this toolkit's implementation of
Checkbox
.
- Since:
- JDK1.0
- See Also:
- Checkbox, CheckboxPeer
createCheckboxMenuItem
protected abstract java.awt.peer.CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
- Creates this toolkit's implementation of
CheckboxMenuItem
using
the specified peer interface.
- Parameters:
- target - the checkbox menu item to be implemented.
- Returns:
- this toolkit's implementation of
CheckboxMenuItem
.
- Since:
- JDK1.0
- See Also:
- CheckboxMenuItem, CheckboxMenuItemPeer
createChoice
protected abstract java.awt.peer.ChoicePeer createChoice(Choice target)
- Creates this toolkit's implementation of
Choice
using
the specified peer interface.
- Parameters:
- target - the choice to be implemented.
- Returns:
- this toolkit's implementation of
Choice
.
- Since:
- JDK1.0
- See Also:
- Choice, ChoicePeer
createComponent
protected java.awt.peer.LightweightPeer createComponent(Component target)
- Creates a peer for a component or container. This peer is windowless
and allows the Component and Container classes to be extended directly
to create windowless components that are defined entirely in java.
- Parameters:
- target - The Component to be created.
createDialog
protected abstract java.awt.peer.DialogPeer createDialog(Dialog target)
- Creates this toolkit's implementation of
Dialog
using
the specified peer interface.
- Parameters:
- target - the dialog to be implemented.
- Returns:
- this toolkit's implementation of
Dialog
.
- Since:
- JDK1.0
- See Also:
- Dialog, DialogPeer
createFileDialog
protected abstract java.awt.peer.FileDialogPeer createFileDialog(FileDialog target)
- Creates this toolkit's implementation of
FileDialog
using
the specified peer interface.
- Parameters:
- target - the file dialog to be implemented.
- Returns:
- this toolkit's implementation of
FileDialog
.
- Since:
- JDK1.0
- See Also:
- FileDialog, FileDialogPeer
createFrame
protected abstract java.awt.peer.FramePeer createFrame(Frame target)
- Creates this toolkit's implementation of
Frame
using
the specified peer interface.
- Parameters:
- target - the frame to be implemented.
- Returns:
- this toolkit's implementation of
Frame
.
- Since:
- JDK1.0
- See Also:
- Frame, FramePeer
createImage
public abstract java.awt.Image createImage(ImageProducer producer)
- Creates an image with the specified image producer.
- Parameters:
- producer - the image producer to be used.
- Returns:
- an image with the specified image producer.
- Since:
- JDK1.0
- See Also:
- Image, ImageProducer, createImage(java.awt.image.ImageProducer)
createImage
public java.awt.Image createImage(byte imagedata)
- Creates an image which decodes the image stored in the specified
byte array.
The data must be in some image format, such as GIF or JPEG,
that is supported by this toolkit.
- Parameters:
- imagedata - an array of bytes, representing
image data in a supported image format.
- Returns:
- an image.
- Since:
- JDK1.1
createImage
public abstract java.awt.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.
The data must be in some image format, such as GIF or JPEG,
that is supported by this toolkit.
- Parameters:
- imagedata - an array of bytes, representing
image data in a supported image format.
- imageoffset - the offset of the beginning
of the data in the array.
- imagelength - the length of the data in the array.
- Returns:
- an image.
- Since:
- JDK1.1
createLabel
protected abstract java.awt.peer.LabelPeer createLabel(Label target)
- Creates this toolkit's implementation of
Label
using
the specified peer interface.
- Parameters:
- target - the label to be implemented.
- Returns:
- this toolkit's implementation of
Label
.
- Since:
- JDK1.0
- See Also:
- Label, LabelPeer
createList
protected abstract java.awt.peer.ListPeer createList(List target)
- Creates this toolkit's implementation of
List
using
the specified peer interface.
- Parameters:
- target - the list to be implemented.
- Returns:
- this toolkit's implementation of
List
.
- Since:
- JDK1.0
- See Also:
- List, ListPeer
createMenu
protected abstract java.awt.peer.MenuPeer createMenu(Menu target)
- Creates this toolkit's implementation of
Menu
using
the specified peer interface.
- Parameters:
- target - the menu to be implemented.
- Returns:
- this toolkit's implementation of
Menu
.
- Since:
- JDK1.0
- See Also:
- Menu, MenuPeer
createMenuBar
protected abstract java.awt.peer.MenuBarPeer createMenuBar(MenuBar target)
- Creates this toolkit's implementation of
MenuBar
using
the specified peer interface.
- Parameters:
- target - the menu bar to be implemented.
- Returns:
- this toolkit's implementation of
MenuBar
.
- Since:
- JDK1.0
- See Also:
- MenuBar, MenuBarPeer
createMenuItem
protected abstract java.awt.peer.MenuItemPeer createMenuItem(MenuItem target)
- Creates this toolkit's implementation of
MenuItem
using
the specified peer interface.
- Parameters:
- target - the menu item to be implemented.
- Returns:
- this toolkit's implementation of
MenuItem
.
- Since:
- JDK1.0
- See Also:
- MenuItem, MenuItemPeer
createPanel
protected abstract java.awt.peer.PanelPeer createPanel(Panel target)
- Creates this toolkit's implementation of
Panel
using
the specified peer interface.
- Parameters:
- target - the panel to be implemented.
- Returns:
- this toolkit's implementation of
Panel
.
- Since:
- JDK1.0
- See Also:
- Panel, PanelPeer
createPopupMenu
protected abstract java.awt.peer.PopupMenuPeer createPopupMenu(PopupMenu target)
- Creates this toolkit's implementation of
PopupMenu
using
the specified peer interface.
- Parameters:
- target - the popup menu to be implemented.
- Returns:
- this toolkit's implementation of
PopupMenu
.
- Since:
- JDK1.1
- See Also:
- PopupMenu, PopupMenuPeer
createScrollPane
protected abstract java.awt.peer.ScrollPanePeer createScrollPane(ScrollPane target)
- Creates this toolkit's implementation of
ScrollPane
using
the specified peer interface.
- Parameters:
- target - the scroll pane to be implemented.
- Returns:
- this toolkit's implementation of
ScrollPane
.
- Since:
- JDK1.1
- See Also:
- ScrollPane, ScrollPanePeer
createScrollbar
protected abstract java.awt.peer.ScrollbarPeer createScrollbar(Scrollbar target)
- Creates this toolkit's implementation of
Scrollbar
using
the specified peer interface.
- Parameters:
- target - the scroll bar to be implemented.
- Returns:
- this toolkit's implementation of
Scrollbar
.
- Since:
- JDK1.0
- See Also:
- Scrollbar, ScrollbarPeer
createTextArea
protected abstract java.awt.peer.TextAreaPeer createTextArea(TextArea target)
- Creates this toolkit's implementation of
TextArea
using
the specified peer interface.
- Parameters:
- target - the text area to be implemented.
- Returns:
- this toolkit's implementation of
TextArea
.
- Since:
- JDK1.0
- See Also:
- TextArea, TextAreaPeer
createTextField
protected abstract java.awt.peer.TextFieldPeer createTextField(TextField target)
- Creates this toolkit's implementation of
TextField
using
the specified peer interface.
- Parameters:
- target - the text field to be implemented.
- Returns:
- this toolkit's implementation of
TextField
.
- Since:
- JDK1.0
- See Also:
- TextField, TextFieldPeer
createWindow
protected abstract java.awt.peer.WindowPeer createWindow(Window target)
- Creates this toolkit's implementation of
Window
using
the specified peer interface.
- Parameters:
- target - the window to be implemented.
- Returns:
- this toolkit's implementation of
Window
.
- Since:
- JDK1.0
- See Also:
- Window, WindowPeer
getColorModel
public abstract java.awt.image.ColorModel getColorModel()
- Determines the color model of this toolkit's screen.
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.
- Returns:
- the color model of this toolkit's screen.
- Since:
- JDK1.0
- See Also:
- ColorModel, getColorModel
getDefaultToolkit
public static synchronized java.awt.Toolkit getDefaultToolkit()
- Gets the default toolkit.
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 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.
- Returns:
- the default toolkit.
- Throws: AWTError
- if a toolkit could not be found, or
if one could not be accessed or instantiated.
- Since:
- JDK1.0
getFontList
public abstract java.lang.String[] getFontList()
- 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 font is also deprecated in 1.1, but only as a
separate fontname. Unicode defines the ZapfDingbat characters
starting at ✀, and as of 1.1 Java supports those characters.
- Returns:
- the names of the available fonts in this toolkit.
- Since:
- JDK1.0
getFontMetrics
public abstract java.awt.FontMetrics getFontMetrics(Font font)
- Gets the screen metrics of the font.
- Parameters:
- font - a font.
- Returns:
- the screen metrics of the specified font in this toolkit.
- Since:
- JDK1.0
getFontPeer
protected abstract java.awt.peer.FontPeer getFontPeer(String name,
int style)
- Creates this toolkit's implementation of
Font
using
the specified peer interface.
- Parameters:
- target - the font to be implemented.
- Returns:
- this toolkit's implementation of
Font
.
- Since:
- JDK1.0
- See Also:
- Font, FontPeer
getImage
public abstract java.awt.Image getImage(String filename)
- Returns an image which gets pixel data from the specified file.
- Parameters:
- filename - the name of a file containing pixel data
in a recognized file format.
- Returns:
- an image which gets its pixel data from
the specified file.
- Since:
- JDK1.0
getImage
public abstract java.awt.Image getImage(URL url)
- Returns an image which gets pixel data from the specified URL.
- Parameters:
- url - the URL to use in fetching the pixel data.
- Returns:
- an image which gets its pixel data from
the specified URL.
- Since:
- JDK1.0
getMenuShortcutKeyMask
public int getMenuShortcutKeyMask()
- Determines which modifier key is the appropriate accelerator
key for menu shortcuts.
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.
- Returns:
- the modifier mask on the
Event
class
that is used for menu shortcuts on this toolkit.
- Since:
- JDK1.1
- See Also:
- MenuBar, MenuShortcut
getNativeContainer
protected static java.awt.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).
getPrintJob
public abstract java.awt.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.
- Returns:
- a
PrintJob
object, or
null
if the user
cancelled the print job.
- Since:
- JDK1.1
- See Also:
- PrintJob
getProperty
public static java.lang.String getProperty(String key,
String defaultValue)
- Gets a property with the specified key and default.
This method returns defaultValue if the property is not found.
getScreenResolution
public abstract int getScreenResolution()
- Returns the screen resolution in dots-per-inch.
- Returns:
- this toolkit's screen resolution, in dots-per-inch.
- Since:
- JDK1.0
getScreenSize
public abstract java.awt.Dimension getScreenSize()
- Gets the size of the screen.
- Returns:
- the size of this toolkit's screen, in pixels.
- Since:
- JDK1.0
getSystemClipboard
public abstract java.awt.datatransfer.Clipboard getSystemClipboard()
- Gets an instance of the system clipboard which interfaces
with clipboard facilities provided by the native platform.
This clipboard enables data transfer between Java programs
and native applications which use native clipboard facilities.
- Returns:
- an instance of the system clipboard.
- Since:
- JDK1.1
- See Also:
- Clipboard
getSystemEventQueue
public final java.awt.EventQueue getSystemEventQueue()
- Get the application's or applet's EventQueue instance.
Depending on the Toolkit implementation, different EventQueues
may be returned for different applets. Applets should
therefore not assume that the EventQueue instance returned
by this method will be shared by other applets or the system.
getSystemEventQueueImpl
protected abstract java.awt.EventQueue getSystemEventQueueImpl()
loadSystemColors
protected void loadSystemColors(int systemColors)
- Fills in the integer array that is supplied as an argument
with the current system color values.
This method is called by the method updateSystemColors
in the SystemColor
class.
- Parameters:
- an - integer array.
- Since:
- JDK1.1
- See Also:
- updateSystemColors
prepareImage
public abstract boolean prepareImage(Image image,
int width,
int height,
ImageObserver observer)
- Prepares an image for rendering.
If the values of the width and height arguments are both
-1
, this method prepares the image for rendering
on the default screen; otherwise, this method prepares an image
for rendering on the default screen at the specified width and height.
The image data is downloaded asynchronously in another thread,
and an appropriately scaled screen representation of the image is
generated.
This method is called by components prepareImage
methods.
Information on the flags returned by this method can be found
with the definition of the ImageObserver
interface.
- Parameters:
- image - the image for which to prepare a
screen representation.
- width - the width of the desired screen
representation, or
-1
.
- height - the height of the desired screen
representation, or
-1
.
- observer - the
ImageObserver
object to be notified as the
image is being prepared.
- Returns:
-
true
if the image has already been
fully prepared; false
otherwise.
- Since:
- JDK1.0
- See Also:
- prepareImage(java.awt.Image,
java.awt.image.ImageObserver), prepareImage(java.awt.Image,
int, int, java.awt.image.ImageObserver), ImageObserver
sync
public abstract void sync()
- Synchronizes this toolkit's graphics state. Some window systems
may do buffering of graphics events.
This method ensures that the display is up-to-date. It is useful
for animation.
- Since:
- JDK1.0
All Packages Class Hierarchy This Package Previous Next Index