Package java.awt Previous
Previous
Java API
Java API
Index
Index
Next
Next

Class Toolkit

Constructors , Methods

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.


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 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.

ParameterDescription
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


createButton

protected abstract ButtonPeer createButton(Button  target) 

Return Value:

Returns this toolkit's implementation of a Button .

ParameterDescription
target the button to be implemented


createCanvas

protected abstract CanvasPeer createCanvas(Canvas  target) 

Return Value:

Returns this toolkit's implementation of a Canvas .

ParameterDescription
target the canvas to be implemented


createCheckbox

protected abstract CheckboxPeer
createCheckbox(Checkbox  target) 

Return Value:

Returns this toolkit's implementation of a Checkbox .

ParameterDescription
target the check box to be implemented


createCheckboxMenuItem

protected abstract CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem  target) 

Return Value:

Returns this toolkit's implementation of a CheckboxMenuItem .

ParameterDescription
target the check box menu item to be implemented


createChoice

protected abstract ChoicePeer createChoice(Choice  target) 

Return Value:

Returns this toolkit's implementation of a Choice .

ParameterDescription
target the choice list to be implemented


createDialog

protected abstract DialogPeer createDialog(Dialog  target) 

Return Value:

Returns this toolkit's implementation of a Dialog .

ParameterDescription
target the dialog window to be implemented


createFileDialog

protected abstract FileDialogPeer
createFileDialog(FileDialog  target) 

Return Value:

Returns this toolkit's implementation of a FileDialog .

ParameterDescription
target the filie dialog window to be implemented


createFrame

protected abstract FramePeer createFrame(Frame  target) 

Return Value:

Returns this toolkit's implementation of a Frame .

ParameterDescription
target the frame to be implemented


createImage

public abstract Image createImage(ImageProducer  producer) 

Return Value:

Returns this toolkit's implementation of an Image .

ParameterDescription
target the image to be implemented


createLabel

protected abstract LabelPeer createLabel(Label  target) 

Return Value:

Returns this toolkit's implementation of a Label .

ParameterDescription
target the label to be implemented


createList

protected abstract ListPeer createList(List  target) 

Return Value:

Returns this toolkit's implementation of a List .

ParameterDescription
target the scrolling list to be implemented


createMenu

protected abstract MenuPeer createMenu(Menu  target) 

Return Value:

Returns this toolkit's implementation of a Menu .

ParameterDescription
target the menu to be implemented


createMenuBar

protected abstract MenuBarPeer
createMenuBar(MenuBar  target) 

Return Value:

Returns this toolkit's implementation of a MenuBar .

ParameterDescription
target the menu bar to be implemented


createMenuItem

protected abstract MenuItemPeer
createMenuItem(MenuItem  target) 

Return Value:

Returns this toolkit's implementation of a MenuItem .

ParameterDescription
target the menu item to be implemented


createPanel

protected abstract PanelPeer createPanel(Panel  target) 

Return Value:

Returns this toolkit's of a Panel .

ParameterDescription
target the panel to be implemented


createScrollbar

protected abstract ScrollbarPeer
createScrollbar(Scrollbar  target) 

Return Value:

Returns this toolkit's implementation of a ScrollBar .

ParameterDescription
target the scroll bar to be implemented


createTextArea

protected abstract TextAreaPeer
createTextArea(TextArea  target) 

Return Value:

Returns this toolkit's implementation of a TextArea .

ParameterDescription
target the text area to be implemented


createTextField

protected abstract TextFieldPeer
createTextField(TextField  target) 

Return Value:

Returns this toolkit's implementation of a TextField .

ParameterDescription
target the text field to be implemented


createWindow

protected abstract WindowPeer createWindow(Window  target) 

Return Value:

Returns this toolkit's implementation of a Window .

ParameterDescription
target the window to be implemented


getColorModel

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.


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.

Return Value:

Returns the default toolkit.

Throw:

AWTError

If a toolkit could not be found or could not be instantiated.


getFontList

public abstract String[] getFontList() 

Return Value:

Returns the names of the available fonts in this toolkit.


getFontMetrics

public abstract FontMetrics getFontMetrics(Font  font) 

Return Value:

Returns the screen metrics of the font argument in this toolkit.

ParameterDescription
font a font


getImage

public abstract Image getImage(String  filename) 

Return Value:

Returns an image which gets its pixel data from the specified file

ParameterDescription
filename a file containing pixel data in a recognized file format


getImage

public abstract Image getImage(URL  url) 

Return Value:

Returns an image which gets its pixel data from the specified URL.

ParameterDescription
url a URL which specifies an image.


getScreenResolution

public abstract int getScreenResolution() 

Return Value:

Returns this toolkit's screen resolution in dots-per-inch.


getScreenSize

public abstract Dimension getScreenSize() 

Return Value:

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 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

ParameterDescription
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


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.



Top© 1996 Sun Microsystems, Inc. All rights reserved.