All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.porting.windowsystem.WindowSystem

java.lang.Object
   |
   +----sun.porting.windowsystem.WindowSystem

public abstract class WindowSystem
extends Object
This is the top-level entry point for a window system implementation. It manages the creation of resources (windows, images, fonts, cursors) and the delivery of input events.


Variable Index

 o gfxSys

Constructor Index

 o WindowSystem()
Make a new WindowSystem object
 o WindowSystem(GraphicsSystem)
Make a new WindowSystem object running on top of the specified GraphicsSystem.

Method Index

 o beep()
Emits an audio beep.
 o checkScrImage(Image, int, int, ImageObserver)
Indicates the construction status of a specified image that is being prepared for display.
 o getBestCursorSize(int, int)
Find the nearest supported cursor size.
 o getCursorImage(Cursor)
Get a CursorImage object that corresponds to a standard "system" cursor.
 o getDefaultWindowSystem()
Obtain an object corresponding to the default window system.
 o getFocusWindow()
Get the window that has the keyboard input focus, or null if the focus is not assigned to any window.
 o getFont(String, int)
Get an implementation of a typeface with the given name and style.
 o getFontMetrics(Font)
Get a valid FontMetrics object for the given font.
 o getGrabbingWindow()
Get the window that has grabbed input, or null if none has.
 o getImage(ImageProducer)
Get an implementation of an image that corresponds to the given ImageRepresentation object.
 o getMaximumCursorColors()
Returns the maximum number of colors allowed in a cursor.
 o getMaximumCursorSize()
Get the maximum supported size for a cursor.
 o getRootWindow()
Return the root window.
 o getScreenColorModel()
Get the color model of the screen.
 o getScreenResolution()
Return the resolution of the screen, in pixels per inch.
 o isCursorVisible()
Query the visibility of the cursor.
 o makeCursorImage(Image, int, int)
Create a new CursorImage object.
 o makeDrawableImage(Component, int, int)
Get an Image object for use as an offscreen drawing area.
 o makeRegion(int, int, int, int)
Get a new rectangular region.
 o makeTopLevelWindow(int, int, int, int, int)
Create a new top-level window of the given type and having the specified dimensions.
 o makeWindow(Window, int, int, int, int)
Create a new window as a child of the given parent window, and having the specified dimensions.
 o prepareScrImage(Image, int, int, ImageObserver)
Prepares an image for rendering.
 o registerToolkitEventHandler(ToolkitEventHandler)
Register a callback handler for receiving events.
 o setCursorImage(CursorImage)
Set the cursor image to match the supplied CursorImage.
 o setCursorVisibility(boolean)
Set the visibility of the cursor.
 o setWindowFactory(WindowFactory)
Change the factory object used to create windows.
 o start()
Start the window system running.
 o sync()
Synchronizes the graphics state.

Variables

 o gfxSys
 protected GraphicsSystem gfxSys

Constructors

 o WindowSystem
 public WindowSystem()
Make a new WindowSystem object

 o WindowSystem
 public WindowSystem(GraphicsSystem gfx)
Make a new WindowSystem object running on top of the specified GraphicsSystem.

Methods

 o getDefaultWindowSystem
 public static WindowSystem getDefaultWindowSystem()
Obtain an object corresponding to the default window system.

 o registerToolkitEventHandler
 public abstract void registerToolkitEventHandler(ToolkitEventHandler h) throws IllegalStateException
Register a callback handler for receiving events.

Parameters:
h - The callback handler, a ToolkitEventHandler object.
 o setWindowFactory
 public abstract void setWindowFactory(WindowFactory factory)
Change the factory object used to create windows. (The factory mechanism is used in case a subclass of Window is needed.) If factory is null, use the window system's default factory.

 o start
 public abstract void start()
Start the window system running. This will create the root window, etc. (A separate start mechanism is necessary in order to break the mutual dependency between WindowSystem and WindowFactory.)

 o getRootWindow
 public abstract Window getRootWindow()
Return the root window. Use with caution!

 o makeWindow
 public abstract Window makeWindow(Window parent,
                                   int x,
                                   int y,
                                   int w,
                                   int h)
Create a new window as a child of the given parent window, and having the specified dimensions. Uses the current WindowFactory.

Parameters:
parent - The parent window.
x - the x coordinate for the window's upper left hand corner, in the coordinate system of the parent window.
y - the y coordinate for the window's upper left hand corner, in the coordinate system of the parent window.
w - the width of the window
h - the height of the window
Returns:
The new Window object.
 o makeTopLevelWindow
 public abstract Window makeTopLevelWindow(int windowType,
                                           int x,
                                           int y,
                                           int w,
                                           int h)
Create a new top-level window of the given type and having the specified dimensions. Uses the current WindowFactory.

Parameters:
windowType - The type of the window
x - the x coordinate for the window's upper left hand corner, in the global coordinate system
y - the y coordinate for the window's upper left hand corner, in the global coordinate system
w - the width of the window
h - the height of the window
Returns:
The new Window object.
 o getFocusWindow
 public abstract Window getFocusWindow()
Get the window that has the keyboard input focus, or null if the focus is not assigned to any window.

Returns:
A Window object corresponding to the window that will receive any keyboard events which occur.
 o getGrabbingWindow
 public abstract Window getGrabbingWindow()
Get the window that has grabbed input, or null if none has.

Returns:
A Window object corresponding to the window that has grabbed input events. Note that the grabbing window will not have the keyboard focus unless it has been specifically assigned to it.
 o makeRegion
 public Region makeRegion(int x,
                          int y,
                          int w,
                          int h)
Get a new rectangular region.

Parameters:
x - The upper left x coordinate of the region
y - The upper left y coordinate of the region
w - The width of the region
h - The height of the region
Returns:
The newly-created Region object.
 o getFont
 public FontPeer getFont(String name,
                         int style)
Get an implementation of a typeface with the given name and style. Style values are as in java.awt.Font.

Parameters:
name - The name of the typeface
style - The style (PLAIN, BOLD, ITALIC) of the font.
Returns:
A FontPeer for the nearest matching font.
See Also:
Font
 o getFontMetrics
 public FontMetrics getFontMetrics(Font font)
Get a valid FontMetrics object for the given font.

Parameters:
font - The java font descriptor for the font
Returns:
The corresponding FontMetrics object.
See Also:
Font
 o getImage
 public Image getImage(ImageProducer producer)
Get an implementation of an image that corresponds to the given ImageRepresentation object.

Parameters:
image - The ImageRepresentation object describing this image
Returns:
An image, initialized from the given ImageRepresentation.
See Also:
Image, ImageRepresentation
 o makeDrawableImage
 public Image makeDrawableImage(Component c,
                                int w,
                                int h)
Get an Image object for use as an offscreen drawing area. The object should have the specified size and color model.

Parameters:
w - The width of the offscreen image
h - The height of the offscreen image
Returns:
An offscreen image into which graphics can be drawn.
 o setCursorVisibility
 public void setCursorVisibility(boolean visible)
Set the visibility of the cursor.

Parameters:
visible - Whether to make the cursor visible or hidden.
 o isCursorVisible
 public boolean isCursorVisible()
Query the visibility of the cursor.

Returns:
true if the cursor is currently visible.
 o makeCursorImage
 public CursorImage makeCursorImage(Image img,
                                    int hotX,
                                    int hotY)
Create a new CursorImage object.

 o getCursorImage
 public CursorImage getCursorImage(Cursor c)
Get a CursorImage object that corresponds to a standard "system" cursor.

Parameters:
c - A Cursor object which specifies a standard system cursor.
Returns:
The corresponding CursorImage.
 o setCursorImage
 public void setCursorImage(CursorImage image)
Set the cursor image to match the supplied CursorImage.

Parameters:
image - The cursor image
 o getMaximumCursorSize
 public Dimension getMaximumCursorSize()
Get the maximum supported size for a cursor.

Returns:
a Dimension object containing the maximum cursor size, or null if there is no maximum. A return value of null implies that there is no maximum; it does not guarantee that all sizes are supported because aspect ratio has not been taken into account.
 o getBestCursorSize
 public Dimension getBestCursorSize(int width,
                                    int height)
Find the nearest supported cursor size.

Returns:
true if the size is supported, false otherwise.
 o getMaximumCursorColors
 public int getMaximumCursorColors()
Returns the maximum number of colors allowed in a cursor. "Transparent" is not to be counted as a color.

Returns:
the maximum number of colors supported in a cursor image.
 o getScreenColorModel
 public ColorModel getScreenColorModel()
Get the color model of the screen.

Returns:
The color model, as a java.awt.image.ColorModel object
 o prepareScrImage
 public boolean prepareScrImage(Image image,
                                int width,
                                int height,
                                ImageObserver observer)
Prepares an image for rendering.

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.

Parameters:
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.
Returns:
true if the image has already been fully prepared; false otherwise.
See Also:
prepareImage, prepareImage, ImageObserver
 o checkScrImage
 public int checkScrImage(Image image,
                          int width,
                          int height,
                          ImageObserver observer)
Indicates the construction status of a specified image that is being prepared for display.

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.

Parameters:
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.
Returns:
the bitwise inclusive OR of the ImageObserver flags for the image data that is currently available.
See Also:
prepareImage, checkImage, checkImage, ImageObserver
 o getScreenResolution
 public int getScreenResolution()
Return the resolution of the screen, in pixels per inch.

 o sync
 public void sync()
Synchronizes the graphics state. Some systems may do buffering of graphics events; this method ensures that the display is up-to-date. It is useful for animation.

 o beep
 public void beep()
Emits an audio beep.


All Packages  Class Hierarchy  This Package  Previous  Next  Index