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.
-
gfxSys
-
-
WindowSystem()
- Make a new
WindowSystem
object
-
WindowSystem(GraphicsSystem)
- Make a new
WindowSystem
object running on top of the specified GraphicsSystem
.
-
beep()
- Emits an audio beep.
-
checkScrImage(Image, int, int, ImageObserver)
- Indicates the construction status of a specified image that is
being prepared for display.
-
getBestCursorSize(int, int)
- Find the nearest supported cursor size.
-
getCursorImage(Cursor)
- Get a
CursorImage
object that corresponds to a standard
"system" cursor.
-
getDefaultWindowSystem()
- Obtain an object corresponding to the default window system.
-
getFocusWindow()
- Get the window that has the keyboard input focus, or null if the
focus is not assigned to any window.
-
getFont(String, int)
- Get an implementation of a typeface with the given name and
style.
-
getFontMetrics(Font)
- Get a valid
FontMetrics
object for the given font.
-
getGrabbingWindow()
- Get the window that has grabbed input, or null if none has.
-
getImage(ImageProducer)
- Get an implementation of an image that corresponds to the
given
ImageRepresentation
object.
-
getMaximumCursorColors()
- Returns the maximum number of colors allowed in a cursor.
-
getMaximumCursorSize()
- Get the maximum supported size for a cursor.
-
getRootWindow()
- Return the root window.
-
getScreenColorModel()
- Get the color model of the screen.
-
getScreenResolution()
- Return the resolution of the screen, in pixels per inch.
-
isCursorVisible()
- Query the visibility of the cursor.
-
makeCursorImage(Image, int, int)
- Create a new
CursorImage
object.
-
makeDrawableImage(Component, int, int)
- Get an
Image
object for use as an offscreen
drawing area.
-
makeRegion(int, int, int, int)
- Get a new rectangular region.
-
makeTopLevelWindow(int, int, int, int, int)
- Create a new top-level window of the given type
and having the specified dimensions.
-
makeWindow(Window, int, int, int, int)
- Create a new window as a child of the given parent window,
and having the specified dimensions.
-
prepareScrImage(Image, int, int, ImageObserver)
- Prepares an image for rendering.
-
registerToolkitEventHandler(ToolkitEventHandler)
- Register a callback handler for receiving events.
-
setCursorImage(CursorImage)
- Set the cursor image to match the supplied
CursorImage
.
-
setCursorVisibility(boolean)
- Set the visibility of the cursor.
-
setWindowFactory(WindowFactory)
- Change the factory object used to create windows.
-
start()
- Start the window system running.
-
sync()
- Synchronizes the graphics state.
gfxSys
protected GraphicsSystem gfxSys
WindowSystem
public WindowSystem()
- Make a new
WindowSystem
object
WindowSystem
public WindowSystem(GraphicsSystem gfx)
- Make a new
WindowSystem
object running on top of the specified GraphicsSystem
.
getDefaultWindowSystem
public static WindowSystem getDefaultWindowSystem()
- Obtain an object corresponding to the default window system.
registerToolkitEventHandler
public abstract void registerToolkitEventHandler(ToolkitEventHandler h) throws IllegalStateException
- Register a callback handler for receiving events.
- Parameters:
- h - The callback handler, a
ToolkitEventHandler
object.
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.
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.)
getRootWindow
public abstract Window getRootWindow()
- Return the root window. Use with caution!
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.
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.
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.
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.
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.
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
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
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
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.
setCursorVisibility
public void setCursorVisibility(boolean visible)
- Set the visibility of the cursor.
- Parameters:
- visible - Whether to make the cursor visible or hidden.
isCursorVisible
public boolean isCursorVisible()
- Query the visibility of the cursor.
- Returns:
- true if the cursor is currently visible.
makeCursorImage
public CursorImage makeCursorImage(Image img,
int hotX,
int hotY)
- Create a new
CursorImage
object.
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.
setCursorImage
public void setCursorImage(CursorImage image)
- Set the cursor image to match the supplied
CursorImage
.
- Parameters:
- image - The cursor image
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.
getBestCursorSize
public Dimension getBestCursorSize(int width,
int height)
- Find the nearest supported cursor size.
- Returns:
- true if the size is supported, false otherwise.
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.
getScreenColorModel
public ColorModel getScreenColorModel()
- Get the color model of the screen.
- Returns:
- The color model, as a java.awt.image.ColorModel object
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
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
getScreenResolution
public int getScreenResolution()
- Return the resolution of the screen, in pixels per inch.
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.
beep
public void beep()
- Emits an audio beep.
All Packages Class Hierarchy This Package Previous Next Index