Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.Toolkit
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.
Field Summary | |
Map | desktopProperties
|
PropertyChangeSupport | desktopPropsSupport
|
Constructor Summary | |
Toolkit()
|
Method Summary | |
void | addPropertyChangeListener(String name,
PropertyChangeListener pcl)
|
void | beep()
|
int | checkImage(Image image,
int width,
int height,
ImageObserver observer)
|
java.awt.peer.ButtonPeer | createButton(Button target)
Button using
the specified peer interface.
|
java.awt.peer.CanvasPeer | createCanvas(Canvas target)
Canvas using
the specified peer interface.
|
java.awt.peer.CheckboxPeer | createCheckbox(Checkbox target)
Checkbox using
the specified peer interface.
|
java.awt.peer.CheckboxMenuItemPeer | createCheckboxMenuItem(CheckboxMenuItem target)
CheckboxMenuItem using
the specified peer interface.
|
java.awt.peer.ChoicePeer | createChoice(Choice target)
Choice using
the specified peer interface.
|
java.awt.peer.LightweightPeer | createComponent(Component target)
|
Cursor | createCustomCursor(Image cursor,
Point hotSpot,
String name)
|
java.awt.peer.DialogPeer | createDialog(Dialog target)
Dialog using
the specified peer interface.
|
java.awt.dnd.peer.DragSourceContextPeer | createDragSourceContextPeer(DragSource ds,
Component c)
|
java.awt.peer.FileDialogPeer | createFileDialog(FileDialog target)
FileDialog using
the specified peer interface.
|
java.awt.peer.FramePeer | createFrame(Frame target)
Frame using
the specified peer interface.
|
Image | createImage(ImageProducer producer)
|
Image | createImage(byte[] imagedata)
|
Image | createImage(byte[] imagedata,
int imageoffset,
int imagelength)
|
java.awt.peer.LabelPeer | createLabel(Label target)
Label using
the specified peer interface.
|
java.awt.peer.ListPeer | createList(List target)
List using
the specified peer interface.
|
java.awt.peer.MenuPeer | createMenu(Menu target)
Menu using
the specified peer interface.
|
java.awt.peer.MenuBarPeer | createMenuBar(MenuBar target)
MenuBar using
the specified peer interface.
|
java.awt.peer.MenuItemPeer | createMenuItem(MenuItem target)
MenuItem using
the specified peer interface.
|
java.awt.peer.PanelPeer | createPanel(Panel target)
Panel using
the specified peer interface.
|
java.awt.peer.PopupMenuPeer | createPopupMenu(PopupMenu target)
PopupMenu using
the specified peer interface.
|
java.awt.peer.ScrollbarPeer | createScrollbar(Scrollbar target)
Scrollbar using
the specified peer interface.
|
java.awt.peer.ScrollPanePeer | createScrollPane(ScrollPane target)
ScrollPane using
the specified peer interface.
|
java.awt.peer.TextAreaPeer | createTextArea(TextArea target)
TextArea using
the specified peer interface.
|
java.awt.peer.TextFieldPeer | createTextField(TextField target)
TextField using
the specified peer interface.
|
java.awt.peer.WindowPeer | createWindow(Window target)
Window using
the specified peer interface.
|
Dimension | getBestCursorSize(int preferredWidth,
int preferredHeight)
|
ColorModel | getColorModel()
|
static Toolkit | getDefaultToolkit()
|
Object | getDesktopProperty(String propertyName)
|
String[] | getFontList()
For 1.1, the following font names are deprecated (the replacement name follows):
The ZapfDingbats font is also deprecated in 1.1, but only as a separate fontname. |
FontMetrics | getFontMetrics(Font font)
|
java.awt.peer.FontPeer | getFontPeer(String name,
int style)
Font using
the specified peer interface.
|
Image | getImage(String filename)
|
Image | getImage(URL url)
|
int | getMaximumCursorColors()
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. |
int | getMenuShortcutKeyMask()
|
static Container | getNativeContainer(Component c)
|
PrintJob | getPrintJob(Frame frame,
String jobtitle,
Properties props)
PrintJob object which is the result
of initiating a print operation on the toolkit's platform.
|
static String | getProperty(String key,
String defaultValue)
|
int | getScreenResolution()
|
Dimension | getScreenSize()
|
Clipboard | getSystemClipboard()
|
EventQueue | getSystemEventQueue()
|
EventQueue | getSystemEventQueueImpl()
|
boolean | hasSetupPage()
|
void | initializeDesktopProperties()
|
Object | lazilyLoadDesktopProperty(String name)
|
void | loadSystemColors(int[] systemColors)
|
boolean | prepareImage(Image image,
int width,
int height,
ImageObserver observer)
|
void | removePropertyChangeListener(String name,
PropertyChangeListener pcl)
|
void | setDesktopProperty(String name,
Object newValue)
|
PageFormat | setupPage(PageFormat page)
|
void | sync()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final Map desktopProperties
protected final PropertyChangeSupport desktopPropsSupport
Constructor Detail |
public Toolkit()
Method Detail |
protected abstract java.awt.peer.ButtonPeer createButton(Button target)
Button
using
the specified peer interface.
target
- the button to be implemented.
Button
.protected abstract java.awt.peer.TextFieldPeer createTextField(TextField target)
TextField
using
the specified peer interface.
target
- the text field to be implemented.
TextField
.protected abstract java.awt.peer.LabelPeer createLabel(Label target)
Label
using
the specified peer interface.
target
- the label to be implemented.
Label
.protected abstract java.awt.peer.ListPeer createList(List target)
List
using
the specified peer interface.
target
- the list to be implemented.
List
.protected abstract java.awt.peer.CheckboxPeer createCheckbox(Checkbox target)
Checkbox
using
the specified peer interface.
target
- the check box to be implemented.
Checkbox
.protected abstract java.awt.peer.ScrollbarPeer createScrollbar(Scrollbar target)
Scrollbar
using
the specified peer interface.
target
- the scroll bar to be implemented.
Scrollbar
.protected abstract java.awt.peer.ScrollPanePeer createScrollPane(ScrollPane target)
ScrollPane
using
the specified peer interface.
target
- the scroll pane to be implemented.
ScrollPane
.protected abstract java.awt.peer.TextAreaPeer createTextArea(TextArea target)
TextArea
using
the specified peer interface.
target
- the text area to be implemented.
TextArea
.protected abstract java.awt.peer.ChoicePeer createChoice(Choice target)
Choice
using
the specified peer interface.
target
- the choice to be implemented.
Choice
.protected abstract java.awt.peer.FramePeer createFrame(Frame target)
Frame
using
the specified peer interface.
target
- the frame to be implemented.
Frame
.protected abstract java.awt.peer.CanvasPeer createCanvas(Canvas target)
Canvas
using
the specified peer interface.
target
- the canvas to be implemented.
Canvas
.protected abstract java.awt.peer.PanelPeer createPanel(Panel target)
Panel
using
the specified peer interface.
target
- the panel to be implemented.
Panel
.protected abstract java.awt.peer.WindowPeer createWindow(Window target)
Window
using
the specified peer interface.
target
- the window to be implemented.
Window
.protected abstract java.awt.peer.DialogPeer createDialog(Dialog target)
Dialog
using
the specified peer interface.
target
- the dialog to be implemented.
Dialog
.protected abstract java.awt.peer.MenuBarPeer createMenuBar(MenuBar target)
MenuBar
using
the specified peer interface.
target
- the menu bar to be implemented.
MenuBar
.protected abstract java.awt.peer.MenuPeer createMenu(Menu target)
Menu
using
the specified peer interface.
target
- the menu to be implemented.
Menu
.protected abstract java.awt.peer.PopupMenuPeer createPopupMenu(PopupMenu target)
PopupMenu
using
the specified peer interface.
target
- the popup menu to be implemented.
PopupMenu
.protected abstract java.awt.peer.MenuItemPeer createMenuItem(MenuItem target)
MenuItem
using
the specified peer interface.
target
- the menu item to be implemented.
MenuItem
.protected abstract java.awt.peer.FileDialogPeer createFileDialog(FileDialog target)
FileDialog
using
the specified peer interface.
target
- the file dialog to be implemented.
FileDialog
.protected abstract java.awt.peer.CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
CheckboxMenuItem
using
the specified peer interface.
target
- the checkbox menu item to be implemented.
CheckboxMenuItem
.protected java.awt.peer.LightweightPeer createComponent(Component target)
target
- The Component to be created.
protected abstract java.awt.peer.FontPeer getFontPeer(String name, int style)
Font
using
the specified peer interface.
target
- the font to be implemented.
Font
.protected void loadSystemColors(int[] systemColors)
This method is called by the method updateSystemColors
in the SystemColor
class.
an
- integer array.
public abstract Dimension getScreenSize()
public abstract int getScreenResolution()
public abstract ColorModel getColorModel()
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.
public abstract String[] getFontList()
For 1.1, the following font names are deprecated (the replacement name follows):
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.
public abstract FontMetrics getFontMetrics(Font font)
font
- a 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 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.
Also loads additional classes into the VM using the property 'AWT.assistive_technologies' specified in the 'awt.properties' file. The form is "AWT.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)
filename
- the name of a file containing pixel data
in a recognized file format.
public abstract Image getImage(URL url)
url
- the URL to use in fetching the pixel data.
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.
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.
true
if the image has already been
fully prepared; false
otherwise.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.
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.
ImageObserver
flags for the
image data that is currently available.public abstract Image createImage(ImageProducer producer)
producer
- the image producer to be used.
public Image createImage(byte[] imagedata)
The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.
imagedata
- an array of bytes, representing
image data in a supported image format.
public abstract Image createImage(byte[] imagedata, int imageoffset, int imagelength)
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.
public abstract PrintJob getPrintJob(Frame frame, String jobtitle, Properties props)
PrintJob
object which is the result
of initiating a print operation on the toolkit's platform.PrintJob
object, or
null
if the user
cancelled the print job.public PageFormat setupPage(PageFormat page)
page
argument is used to initialize controls
in the page setup dialog.
If the user cancels the dialog, then the method returns the
original page
object unmodified.
If the user okays the dialog then the method returns a new
PageFormat object with the indicated changes.
In either case the original page
object will
not be modified.
If the OS does not support a setup page
dialog then the dialog will act as if the user
cancelled the dialog.
page
- the default PageFormat presented to the user
for modification
page
object if the dialog
is cancelled, or a new PageFormat object containing
the format indicated by the user if the dialog is
acknowledgedpublic boolean hasSetupPage()
public abstract void beep()
public abstract Clipboard getSystemClipboard()
This clipboard enables data transfer between Java programs and native applications which use native clipboard facilities.
public int getMenuShortcutKeyMask()
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.
Event
class
that is used for menu shortcuts on this toolkit.protected static Container getNativeContainer(Component c)
public Cursor createCustomCursor(Image cursor, Point hotSpot, String name) throws IndexOutOfBoundsException
image
- the image to display when the cursor is active.
hotSpot
- the X and Y of the large cursor's hot spot. The
hotSpot values must be less than the Dimension returned by
getBestCursorSize().
name
- a localized description of the cursor, for Java Accessibility use.
public Dimension getBestCursorSize(int preferredWidth, int preferredHeight)
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.
desiredWidth
- the preferred cursor width the component would like
to use.
desiredHeight
- the preferred cursor height the component would like
to use.
public int getMaximumCursorColors()
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 static String getProperty(String key, String defaultValue)
public final EventQueue getSystemEventQueue()
protected abstract EventQueue getSystemEventQueueImpl()
public abstract java.awt.dnd.peer.DragSourceContextPeer createDragSourceContextPeer(DragSource ds, Component c) throws InvalidDnDOperationException
public final Object getDesktopProperty(String propertyName)
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)
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |