Packages  This Package  Prev  Next  Index  

§1.41 Class Toolkit

public  abstract  class  java.awt.Toolkit
    extends  java.lang.Object  (I-§1.12)
{
        // Constructors
    public Toolkit();	§1.41.1

        // Methods
    public abstract int	§1.41.2
        checkImage(Image  image, int  width, int height, 
                                      ImageObserver  observer);
    protected abstract ButtonPeer 	§1.41.3
        createButton(Button  target);
    protected abstract CanvasPeer	§1.41.4
        createCanvas(Canvas  target);
    protected abstract CheckboxPeer	§1.41.5
        createCheckbox(Checkbox  target);
    protected abstract CheckboxMenuItemPeer	§1.41.6
        createCheckboxMenuItem(CheckboxMenuItem  target);
    protected abstract ChoicePeer 	§1.41.7
        createChoice(Choice  target);
    protected abstract DialogPeer	§1.41.8
        createDialog(Dialog  target);
    protected abstract FileDialogPeer	§1.41.9
        createFileDialog(FileDialog  target);
    protected abstract FramePeer createFrame(Frame  target);	§1.41.10
        public abstract Image	§1.41.11
        createImage(ImageProducer  producer);
    protected abstract LabelPeer createLabel(Label  target);	§1.41.12
        protected abstract ListPeer createList(List  target);	§1.41.13
        protected abstract MenuPeer createMenu(Menu  target);	§1.41.14
    protected abstract MenuBarPeer	§1.41.15
        createMenuBar(MenuBar  target);
    protected abstract MenuItemPeer	§1.41.16
        createMenuItem(MenuItem  target);
    protected abstract PanelPeer createPanel(Panel  target);	§1.41.17
        protected abstract ScrollbarPeer	§1.41.18
        createScrollbar(Scrollbar  target);
    protected abstract TextAreaPeer	§1.41.19
        createTextArea(TextArea  target);
    protected abstract TextFieldPeer	§1.41.20
        createTextField(TextField  target);
    protected abstract WindowPeer	§1.41.21
        createWindow(Window  target);
    public abstract ColorModel getColorModel();	§1.41.22
    public static Toolkit getDefaultToolkit();	§1.41.23
    public abstract String[] getFontList();	§1.41.24
    public abstract FontMetrics	§1.41.25
        getFontMetrics(Font  font);
    public abstract Image getImage(String  filename);	§1.41.26
    public abstract Image getImage(URL  url);	§1.41.27
    public abstract int getScreenResolution();	§1.41.28
    public abstract Dimension getScreenSize();	§1.41.29
    public abstract boolean	§1.41.30
        prepareImage(Image  image, int  width, int  height,
                                  ImageObserver  observer);
    public abstract void sync();	§1.41.31
}
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.


Constructors

Toolkit

public Toolkit()
The default constructor for a toolkit.

Methods

checkImage

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 (II-§1.41.30) method to force the loading of an image.


This toolkit method is used by the checkImage methods (II-§1.10.4, §1.10.5) of Component.


Information on the flags returned by this method can be found in II-§2.11.

Parameters:
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
Returns:
the bitwise inclusive OR of the ImageObserver (II-§2.11) flags indicating what information about the image is available.

createButton

protected abstract ButtonPeer createButton(Button target)
Parameters:
target - the button to be implemented
Returns:
this toolkit's implementation of a Button (II-§1.2).

createCanvas

protected abstract CanvasPeer createCanvas(Canvas target)
Parameters:
target - the canvas to be implemented
Returns:
this toolkit's implementation of a Canvas (II-§1.3).

createCheckbox

protected abstract CheckboxPeer
createCheckbox(Checkbox target)
Parameters:
target - the check box to be implemented
Returns:
this toolkit's implementation of a Checkbox (II-§1.5).

createCheckboxMenuItem

protected abstract CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem target)
Parameters:
target - the check box menu item to be implemented
Returns:
this toolkit's implementation of a CheckboxMenuItem (II-§1.7).

createChoice

protected abstract ChoicePeer createChoice(Choice target)
Parameters:
target - the choice list to be implemented
Returns:
this toolkit's implementation of a Choice (II-§1.8).

createDialog

protected abstract DialogPeer createDialog(Dialog target)
Parameters:
target - the dialog window to be implemented
Returns:
this toolkit's implementation of a Dialog (II-§1.12).

createFileDialog

protected abstract FileDialogPeer
createFileDialog(FileDialog target)
Parameters:
target - the filie dialog window to be implemented
Returns:
this toolkit's implementation of a FileDialog (II-§1.15).

createFrame

protected abstract FramePeer createFrame(Frame target)
Parameters:
target - the frame to be implemented
Returns:
this toolkit's implementation of a Frame (II-§1.19).

createImage

public abstract Image createImage(ImageProducer producer)
Parameters:
target - the image to be implemented
Returns:
this toolkit's implementation of an Image (II-§1.24).

createLabel

protected abstract LabelPeer createLabel(Label target)
Parameters:
target - the label to be implemented
Returns:
this toolkit's implementation of a Label (II-§1.26).

createList

protected abstract ListPeer createList(List target)
Parameters:
target - the scrolling list to be implemented
Returns:
this toolkit's implementation of a List (II-§1.27).

createMenu

protected abstract MenuPeer createMenu(Menu target)
Parameters:
target - the menu to be implemented
Returns:
this toolkit's implementation of a Menu (II-§1.29).

createMenuBar

protected abstract MenuBarPeer
createMenuBar(MenuBar target)
Parameters:
target - the menu bar to be implemented
Returns:
this toolkit's implementation of a MenuBar (II-§1.30).

createMenuItem

protected abstract MenuItemPeer
createMenuItem(MenuItem target)
Parameters:
target - the menu item to be implemented
Returns:
this toolkit's implementation of a MenuItem (II-§1.32).

createPanel

protected abstract PanelPeer createPanel(Panel target)
Parameters:
target - the panel to be implemented
Returns:
this toolkit's of a Panel (II-§1.33).

createScrollbar

protected abstract ScrollbarPeer
createScrollbar(Scrollbar target)
Parameters:
target - the scroll bar to be implemented
Returns:
this toolkit's implementation of a ScrollBar (II-§1.37).

createTextArea

protected abstract TextAreaPeer
createTextArea(TextArea target)
Parameters:
target - the text area to be implemented
Returns:
this toolkit's implementation of a TextArea (II-§1.38).

createTextField

protected abstract TextFieldPeer
createTextField(TextField target)
Parameters:
target - the text field to be implemented
Returns:
this toolkit's implementation of a TextField (II-§1.40).

createWindow

protected abstract WindowPeer createWindow(Window target)
Parameters:
target - the window to be implemented
Returns:
this toolkit's implementation of a Window (II-§1.42).

getColorModel

public abstract ColorModel getColorModel()
Determine's the color model of this toolkit's screen.
The ColorModel (II-§2.1) 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 (II-§1.10.13) of Component.

Returns:
the color model of the tookit's screen.

getDefaultToolkit

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.
Returns:
the default toolkit.
Throws
AWTError (II-§1.46)
If a toolkit could not be found or could not be instantiated.

getFontList

public abstract String[] getFontList()
Returns:
the names of the available fonts in this toolkit.

getFontMetrics

public abstract FontMetrics getFontMetrics(Font font)
Parameters:
font - a font
Returns:
the screen metrics of the font argument in this toolkit.

getImage

public abstract Image getImage(String filename)
Parameters:
filename - a file containing pixel data in a recognized file format
Returns:
an image which gets its pixel data from the specified file

getImage

public abstract Image getImage(URL url)
Parameters:
url - a URL which specifies an image.
Returns:
an image which gets its pixel data from the specified URL.

getScreenResolution

public abstract int getScreenResolution()
Returns:
this toolkit's screen resolution in dots-per-inch.

getScreenSize

public abstract Dimension getScreenSize()
Returns:
the size of this toolkit's screen in pixels.

prepareImage

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 (II-§1.10.54, §1.10.55) of Component.


Information on the flags returned by this method can be found in II-§2.11.

Parameters:
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
Returns:
true if the image has already been fully prepared; false otherwise

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.

Packages  This Package  Prev  Next  Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com