Package java.awt |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
public abstract class java.awt.Toolkit extends java.lang.Object { // Constructors public Toolkit(); // Methods public abstract int checkImage(Image image, int width, int height, ImageObserver observer); protected abstract ButtonPeer createButton(Button target); protected abstract CanvasPeer createCanvas(Canvas target); protected abstract CheckboxPeer createCheckbox(Checkbox target); protected abstract CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target); protected abstract ChoicePeer createChoice(Choice target); protected abstract DialogPeer createDialog(Dialog target); protected abstract FileDialogPeer createFileDialog(FileDialog target); protected abstract FramePeer createFrame(Frame target); public abstract Image createImage(ImageProducer producer); protected abstract LabelPeer createLabel(Label target); protected abstract ListPeer createList(List target); protected abstract MenuPeer createMenu(Menu target); protected abstract MenuBarPeer createMenuBar(MenuBar target); protected abstract MenuItemPeer createMenuItem(MenuItem target); protected abstract PanelPeer createPanel(Panel target); protected abstract ScrollbarPeer createScrollbar(Scrollbar target); protected abstract TextAreaPeer createTextArea(TextArea target); protected abstract TextFieldPeer createTextField(TextField target); protected abstract WindowPeer createWindow(Window target); public abstract ColorModel getColorModel(); public static Toolkit getDefaultToolkit(); public abstract String[] getFontList(); public abstract FontMetrics getFontMetrics(Font font); public abstract Image getImage(String filename); public abstract Image getImage(URL url); public abstract int getScreenResolution(); public abstract Dimension getScreenSize(); public abstract boolean prepareImage(Image image, int width, int height, ImageObserver observer); public abstract void sync(); }
This class is the abstract superclass of all actual implementations of the Abstract Window Toolkit. Subclasses of the class are used to bind the various components to particular native toolkit implementations.
Most applications should not call any of the methods is this class directly. These methods are called by the addNotify methods of the various components in the Abstract Window Toolkit.
public Toolkit()The default constructor for a toolkit.
public abstract int checkImage(Image image, int width, int height, ImageObserver observer)If the width and height arguments are both -1, this method returns the status of the construction of a screen representaion of the specified image in this toolkit. Otherwise, this method returns the status of the construction of a scaled representation of the specified image at the specified width and height.
This method does not cause the image to begin loading. An application must use the prepareImage method to force the loading of an image.
This toolkit method is used by the checkImage methods of Component.
Information on the flags returned by this method can be found in II-§2.11.
Return Value:
Returns the bitwise inclusive OR of the ImageObserver flags indicating what information about the image is available.
Parameter Description image the image whose status is being checked width the width of the scaled version to check the status of height the height of the scaled version to check the status of observer the ImageObserver object to be notified as the image is being prepared
protected abstract ButtonPeer createButton(Button target)Return Value:
Returns this toolkit's implementation of a Button .
Parameter Description target the button to be implemented
protected abstract CanvasPeer createCanvas(Canvas target)Return Value:
Returns this toolkit's implementation of a Canvas .
Parameter Description target the canvas to be implemented
protected abstract CheckboxPeer createCheckbox(Checkbox target)Return Value:
Returns this toolkit's implementation of a Checkbox .
Parameter Description target the check box to be implemented
protected abstract CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)Return Value:
Returns this toolkit's implementation of a CheckboxMenuItem .
Parameter Description target the check box menu item to be implemented
protected abstract ChoicePeer createChoice(Choice target)Return Value:
Returns this toolkit's implementation of a Choice .
Parameter Description target the choice list to be implemented
protected abstract DialogPeer createDialog(Dialog target)Return Value:
Returns this toolkit's implementation of a Dialog .
Parameter Description target the dialog window to be implemented
protected abstract FileDialogPeer createFileDialog(FileDialog target)Return Value:
Returns this toolkit's implementation of a FileDialog .
Parameter Description target the filie dialog window to be implemented
protected abstract FramePeer createFrame(Frame target)Return Value:
Returns this toolkit's implementation of a Frame .
Parameter Description target the frame to be implemented
public abstract Image createImage(ImageProducer producer)Return Value:
Returns this toolkit's implementation of an Image .
Parameter Description target the image to be implemented
protected abstract LabelPeer createLabel(Label target)Return Value:
Returns this toolkit's implementation of a Label .
Parameter Description target the label to be implemented
protected abstract ListPeer createList(List target)Return Value:
Returns this toolkit's implementation of a List .
Parameter Description target the scrolling list to be implemented
protected abstract MenuPeer createMenu(Menu target)Return Value:
Returns this toolkit's implementation of a Menu .
Parameter Description target the menu to be implemented
protected abstract MenuBarPeer createMenuBar(MenuBar target)Return Value:
Returns this toolkit's implementation of a MenuBar .
Parameter Description target the menu bar to be implemented
protected abstract MenuItemPeer createMenuItem(MenuItem target)Return Value:
Returns this toolkit's implementation of a MenuItem .
Parameter Description target the menu item to be implemented
protected abstract PanelPeer createPanel(Panel target)Return Value:
Returns this toolkit's of a Panel .
Parameter Description target the panel to be implemented
protected abstract ScrollbarPeer createScrollbar(Scrollbar target)Return Value:
Returns this toolkit's implementation of a ScrollBar .
Parameter Description target the scroll bar to be implemented
protected abstract TextAreaPeer createTextArea(TextArea target)Return Value:
Returns this toolkit's implementation of a TextArea .
Parameter Description target the text area to be implemented
protected abstract TextFieldPeer createTextField(TextField target)Return Value:
Returns this toolkit's implementation of a TextField .
Parameter Description target the text field to be implemented
protected abstract WindowPeer createWindow(Window target)Return Value:
Returns this toolkit's implementation of a Window .
Parameter Description target the window to be implemented
public abstract ColorModel getColorModel()Determine's the color model of this toolkit's screen.
The ColorModel is an abstract class that encapsulates how to translate between pixel values of an image and its red, green, blue, and alpha components.
This toolkit method is used by the getColorModel method of Component.
Return Value:
Returns the color model of the tookit's screen.
public static 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.
Return Value:
Returns the default toolkit.
Throw:
If a toolkit could not be found or could not be instantiated.
public abstract String[] getFontList()Return Value:
Returns the names of the available fonts in this toolkit.
public abstract FontMetrics getFontMetrics(Font font)Return Value:
Returns the screen metrics of the font argument in this toolkit.
Parameter Description font a font
public abstract Image getImage(String filename)Return Value:
Returns an image which gets its pixel data from the specified file
Parameter Description filename a file containing pixel data in a recognized file format
public abstract Image getImage(URL url)Return Value:
Returns an image which gets its pixel data from the specified URL.
Parameter Description url a URL which specifies an image.
public abstract int getScreenResolution()Return Value:
Returns this toolkit's screen resolution in dots-per-inch.
public abstract Dimension getScreenSize()Return Value:
Returns the size of this toolkit's screen in pixels.
public abstract boolean prepareImage(Image image, int width, int height, ImageObserver observer)Prepares an image for rendering. If 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 toolkit method is used by the prepareImage methods of Component.
Information on the flags returned by this method can be found in Interface ImageObserver.
Return Value:
Returns true if the image has already been fully prepared; false otherwise
Parameter Description image the image to prepare a screen representation for width the width of the desired screen representation height the height of the desired screen representation observer the ImageObserver object to be notified as the image is being prepared
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.