
 |
Chapter 19 java.awt Reference |
 |
Toolkit
Name
Toolkit
The abstract Toolkit class
provides access to platform-specific details like window size and available
fonts. It also deals with creating all the components' peer objects
when you call addNotify().
public abstract class java.awt.Toolkit
extends java.lang.Object {
// Class Methods
public static synchronized Toolkit getDefaultToolkit();
protected static Container getNativeContainer (Component c);
public static String getProperty (String key, String defaultValue);
// Instance Methods
public abstract void beep();
public abstract int checkImage (Image image, int width, int height,
ImageObserver observer);
public abstract Image createImage (ImageProducer producer);
public Image createImage (byte[] imagedata);
public abstract Image createImage (byte[ ] imagedata, int imageoffset,
int imagelength);
public abstract ColorModel getColorModel();
public abstract String[] getFontList();
public abstract FontMetrics getFontMetrics (Font font);
public abstract Image getImage (String filename);
public abstract Image getImage (URL url);
public int getMenuShortcutKeyMask();
public abstract PrintJob getPrintJob (Frame frame, String jobtitle,
Properties props);
public abstract int getScreenResolution();
public abstract Dimension getScreenSize();
public abstract Clipboard getSystemClipboard();
public final EventQueue getSystemEventQueue();
public abstract boolean prepareImage (Image image, int width, int height,
ImageObserver observer);
public abstract void sync();
// Protected Instance Methods
protected abstract ButtonPeer createButton (Button b);
protected abstract CanvasPeer createCanvas (Canvas c);
protected abstract CheckboxPeer createCheckbox (Checkbox cb);
protected abstract CheckboxMenuItemPeer createCheckboxMenuItem
(CheckboxMenuItem cmi);
protected abstract ChoicePeer createChoice (Choice c);
protected LightweightPeer createComponent(Component target);
protected abstract DialogPeer createDialog (Dialog d);
protected abstract FileDialogPeer createFileDialog (FileDialog fd);
protected abstract FramePeer createFrame (Frame f);
protected abstract LabelPeer createLabel (Label l);
protected abstract ListPeer createList (List l);
protected abstract MenuPeer createMenu (Menu m);
protected abstract MenuBarPeer createMenuBar (MenuBar mb);
protected abstract MenuItemPeer createMenuItem (MenuItem mi);
protected abstract PanelPeer createPanel (Panel p);
protected abstract PopupMenuPeer createPopupMenu (PopupMenu target);
protected abstract ScrollPanePeer createScrollPane (ScrollPane target);
protected abstract ScrollbarPeer createScrollbar (Scrollbar sb);
protected abstract TextAreaPeer createTextArea (TextArea ta);
protected abstract TextFieldPeer createTextField (TextField tf);
protected abstract WindowPeer createWindow (Window w);
protected abstract FontPeer getFontPeer (String name, int style);
protected abstract EventQueue getSystemEventQueueImpl();
protected void loadSystemColors (int[] systemColors);
}
- Throws
-
- AWTError
-
If the toolkit for
the current platform cannot be found.
- Returns
-
The system's default Toolkit.
- Returns
-
The native container for the given component. The component's immediate
parent may be a lightweight component.
- Parameters
-
- key
-
The name of a property.
- defaultValue
-
A default value to return if the property is not found.
- Returns
-
The value of the property described by key,
or defaultValue if it is not
found.
- Description
-
Produces an audible beep.
- Parameters
-
- image
-
Image to check.
- width
-
Width of the scaled image; -1 if image will be rendered
unscaled.
- height
-
Height of the scaled image; -1 if image will be rendered
unscaled.
- observer
-
The Component
that image will be rendered on.
- Returns
-
The ImageObserver flags ORed
together for the data that is now available.
- Description
-
Checks on the status of the construction of a screen representation of
image on observer.
- Parameters
-
- producer
-
An ImageProducer
that generates data for the desired image.
- Returns
-
Newly created Image.
- Description
-
Creates a new Image from an
ImageProducer.
- Parameters
-
- imagedata
-
Raw data representing an image.
- Returns
-
Newly created Image.
- Description
-
Creates a new Image from the
imagedata provided.
- Parameters
-
- imagedata
-
Raw data representing one or more images.
- imageoffset
-
An offset into the data given.
- imagelength
-
The length of data to use.
- Returns
-
Newly created Image.
- Description
-
Creates a new Image from the
imagedata provided, starting
at imageoffset bytes and reading
imagelength bytes.
- Returns
-
The current ColorModel used
by the system.
- Returns
-
A String array of the set of
Java fonts available with this Toolkit.
- Parameters
-
- font
-
A Font whose
metrics are desired
- Returns
-
The current FontMetrics for
the font on the user's
system.
- Parameters
-
- filename
-
Location of Image
on local filesystem
- Returns
-
The Image that needs to be
fetched.
- Description
-
Fetches an image from the local file system.
- Parameters
-
- url
-
Location of Image.
- Returns
-
The Image that needs to be
fetched.
- Description
-
Fetches an image from a URL.
- Returns
-
The modifier key mask used for menu shortcuts. This will be one of the
mask constants defined in java.awt.Event.
- Parameters
-
- frame
-
The frame
to be used as the parent of a platform-specific printing dialog.
- jobtitle
-
The name of the job.
- props
-
Properties for this print job.
- Returns
-
A PrintJob object. If the user
canceled the printing operation, null
is returned.
- Returns
-
The current resolution of the user's screen, in dots-per-inch.
- Returns
-
The size of the screen available to the Toolkit,
in pixels, as a Dimension object.
- Returns
-
A Clipboard object that can
be used for cut, copy, and paste operations.
- Returns
-
A reference to the system's event queue, allowing the program to post new events or inspect the queue.
- Parameters
-
- image
-
Image to check.
- width
-
Width of the scaled image; -1 if image will be rendered
unscaled.
- height
-
Height of the scaled image; -1 if image will be rendered
unscaled.
- observer
-
The Component
that image will be rendered on.
- Returns
-
true if image fully loaded,
false otherwise.
- Description
-
Forces the system to start loading the image.
- Description
-
Flushes the display of the underlying graphics context.
- Parameters
-
- b
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Button.
- Parameters
-
- c
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Canvas.
- Parameters
-
- cb
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Checkbox.
- Parameters
-
- cmi
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the CheckboxMenuItem.
- Parameters
-
- c
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Choice.
- Parameters
-
- target
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Component.
- Parameters
-
- d
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Dialog.
- Parameters
-
- fd
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the FileDialog.
- Parameters
-
- f
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Frame.
- Parameters
-
- l
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Label.
- Parameters
-
- l
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the List.
- Parameters
-
- m
-
Menu whose
peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the given Menu.
- Parameters
-
- mb
-
MenuBar whose
peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the MenuBar.
- Parameters
-
- mi
-
MenuItem
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the MenuItem.
- Parameters
-
- p
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Panel.
- Parameters
-
- target
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the PopupMenu.
- Parameters
-
- target
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the ScrollPane.
- Parameters
-
- sb
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Scrollbar.
- Parameters
-
- ta
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the TextArea.
- Parameters
-
- tf
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the TextField.
- Parameters
-
- w
-
Component
whose peer needs to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a peer for the Window.
- Parameters
-
- name
-
Name of the font to be created.
- style
-
Style of the font to be created.
- Returns
-
Newly created peer.
- Description
-
Creates a FontPeer.
- Returns
-
A toolkit-specific EventQueue object.
- Description
-
Fills the given integer array with the current system colors.
Button, ButtonPeer,
Canvas, CanvasPeer,
Checkbox, CheckboxMenuItem,
CheckboxMenuItemPeer, CheckboxPeer,
Choice, ChoicePeer,
Clipboard, ColorModel,
Component, Container,
Dialog, DialogPeer,
Dimension, FileDialog,
FileDialogPeer, Font,
FontMetrics, FontPeer,
Frame, FramePeer,
Image, ImageObserver,
ImageProducer, Label,
LabelPeer, LightweightPeer,
List, ListPeer,
Menu, MenuBar,
MenuBarPeer, MenuItem,
MenuItemPeer, MenuPeer,
Panel, PanelPeer,
PrintJob, Scrollbar,
ScrollbarPeer, ScrollPane,
ScrollPanePeer, String,
TextArea, TextAreaPeer,
TextField, TextFieldPeer,
Window, WindowPeer
|