gnu.awt.xlib

Class XToolkit


public class XToolkit
extends ClasspathToolkit

Field Summary

Fields inherited from class java.awt.Toolkit

Object>(), desktopProperties, desktopPropsSupport

Constructor Summary

XToolkit()
Default constructor for subclasses.

Method Summary

void
beep()
Causes a "beep" tone to be generated.
int
checkImage(Image image, int width, int height, ImageObserver observer)
Checks the status of specified image as it is being readied for rendering.
protected ButtonPeer
createButton(Button frontend)
Creates a peer object for the specified Button.
protected CanvasPeer
createCanvas(Canvas frontend)
Creates a peer object for the specified Canvas.
protected CheckboxPeer
createCheckbox(Checkbox frontend)
Creates a peer object for the specified Checkbox.
protected CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem frontend)
Creates a peer object for the specified CheckboxMenuItem.
protected ChoicePeer
createChoice(Choice frontend)
Creates a peer object for the specified Choice.
protected DialogPeer
createDialog(Dialog frontend)
Creates a peer object for the specified Dialog.
DragGestureRecognizer
createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl)
DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent dge)
EmbeddedWindowPeer
createEmbeddedWindow(EmbeddedWindow w)
Creates an embedded window peer, and associates it with an EmbeddedWindow object.
protected FileDialogPeer
createFileDialog(FileDialog frontend)
Creates a peer object for the specified FileDialog.
Font
createFont(int format, InputStream stream)
Creates a font, reading the glyph definitions from a stream.
protected FramePeer
createFrame(Frame frontend)
Creates a peer object for the specified Frame.
Image
createImage(byte[] imagedata, int imageoffset, int imagelength)
Creates an image from the specified portion of the byte array passed.
Image
createImage(ImageProducer producer)
Creates an image using the specified ImageProducer
Image
createImage(String filename)
Image
createImage(URL url)
protected LabelPeer
createLabel(Label frontend)
Creates a peer object for the specified Label.
protected ListPeer
createList(List frontend)
Creates a peer object for the specified List.
protected MenuPeer
createMenu(Menu frontend)
Creates a peer object for the specified Menu.
protected MenuBarPeer
createMenuBar(MenuBar frontend)
Creates a peer object for the specified MenuBar.
protected MenuItemPeer
createMenuItem(MenuItem frontend)
Creates a peer object for the specified MenuItem.
protected PanelPeer
createPanel(Panel frontend)
Creates a peer object for the specified Panel.
protected PopupMenuPeer
createPopupMenu(PopupMenu frontend)
Creates a peer object for the specified PopupMenu.
RobotPeer
createRobot(GraphicsDevice screen)
Creates a RobotPeer on a given GraphicsDevice.
protected ScrollPanePeer
createScrollPane(ScrollPane frontend)
Creates a peer object for the specified ScrollPane.
protected ScrollbarPeer
createScrollbar(Scrollbar frontend)
Creates a peer object for the specified Scrollbar.
protected TextAreaPeer
createTextArea(TextArea frontend)
Creates a peer object for the specified TextArea.
protected TextFieldPeer
createTextField(TextField frontend)
Creates a peer object for the specified TextField.
protected WindowPeer
createWindow(Window frontend)
Creates a peer object for the specified Window.
void
flushIfIdle()
ClasspathFontPeer
getClasspathFontPeer(String name, Map<K,V> attrs)
Acquires an appropriate ClasspathFontPeer, for use in classpath's implementation of Font.
ColorModel
getColorModel()
Returns the color model of the screen.
String[]
getFontList()
Deprecated.
FontMetrics
getFontMetrics(Font font)
Deprecated.
protected FontPeer
getFontPeer(String name, int style)
Deprecated.
Image
getImage(String filename)
Returns an image from the specified file, which must be in a recognized format.
Image
getImage(URL url)
Returns an image from the specified URL, which must be in a recognized format.
GraphicsEnvironment
getLocalGraphicsEnvironment()
Returns a shared instance of the local, platform-specific graphics environment.
PrintJob
getPrintJob(Frame frame, String title, Properties props)
Returns a instance of PrintJob for the specified arguments.
int
getScreenResolution()
Returns the screen resolution in dots per square inch.
Dimension
getScreenSize()
Returns the dimensions of the screen in pixels.
Clipboard
getSystemClipboard()
Returns the system clipboard.
protected EventQueue
getSystemEventQueueImpl()
Returns the event queue that is suitable for the calling context.
boolean
isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType)
boolean
isModalityTypeSupported(Dialog.ModalityType modalityType)
void
iterateNativeQueue(EventQueue locked, boolean block)
Checks the native event queue for events.
Map<K,V>
mapInputMethodHighlight(InputMethodHighlight highlight)
boolean
nativeQueueEmpty()
boolean
prepareImage(Image image, int width, int height, ImageObserver observer)
Readies an image to be rendered on the screen.
void
setAlwaysOnTop(boolean b)
void
sync()
Flushes any buffered data to the screen so that it is in sync with what the AWT system has drawn to it.
void
wakeNativeQueue()

Methods inherited from class gnu.java.awt.ClasspathToolkit

createDesktopPeer, createEmbeddedWindow, createFont, createRobot, getClasspathFontPeer, getFont, getLocalGraphicsEnvironment, getMouseNumberOfButtons, registerImageIOSpis

Methods inherited from class java.awt.Toolkit

addAWTEventListener, addPropertyChangeListener, beep, checkImage, createButton, createCanvas, createCheckbox, createCheckboxMenuItem, createChoice, createComponent, createCustomCursor, createDesktopPeer, createDialog, createDragSourceContextPeer, createFileDialog, createFrame, createImage, createImage, createImage, createImage, createImage, createLabel, createList, createMenu, createMenuBar, createMenuItem, createPanel, createPopupMenu, createScrollPane, createScrollbar, createTextArea, createTextField, createWindow, extends DragGestureRecognizer> T createDragGestureRecognizer, getAWTEventListeners, getAWTEventListeners, getBestCursorSize, getColorModel, getDefaultToolkit, getDesktopProperty, getFontList, getFontMetrics, getFontPeer, getImage, getImage, getLockingKeyState, getMaximumCursorColors, getMenuShortcutKeyMask, getMouseInfoPeer, getNativeContainer, getPrintJob, getPrintJob, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getScreenInsets, getScreenResolution, getScreenSize, getSystemClipboard, getSystemEventQueue, getSystemEventQueueImpl, getSystemSelection, initializeDesktopProperties, isDynamicLayoutActive, isDynamicLayoutSet, isFrameStateSupported, isModalExclusionTypeSupported, isModalityTypeSupported, lazilyLoadDesktopProperty, loadSystemColors, mapInputMethodHighlight, prepareImage, removeAWTEventListener, removePropertyChangeListener, setDesktopProperty, setDynamicLayout, setLockingKeyState, sync

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

XToolkit

public XToolkit()
Default constructor for subclasses.

Method Details

beep

public void beep()
Causes a "beep" tone to be generated.
Overrides:
beep in interface Toolkit

checkImage

public int checkImage(Image image,
                      int width,
                      int height,
                      ImageObserver observer)
Checks the status of specified image as it is being readied for rendering.
Overrides:
checkImage in interface Toolkit
Parameters:
image - The image to prepare for rendering.
width - The width of the image.
height - The height of the image.
observer - The observer to receive events about the preparation process.
Returns:
A union of the bitmasks from java.awt.image.ImageObserver that indicates the current state of the imaging readying process.

createButton

protected ButtonPeer createButton(Button frontend)
Creates a peer object for the specified Button.
Overrides:
createButton in interface Toolkit
Parameters:
Returns:
The peer for the specified Button object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createCanvas

protected CanvasPeer createCanvas(Canvas frontend)
Creates a peer object for the specified Canvas.
Overrides:
createCanvas in interface Toolkit
Parameters:
Returns:
The peer for the specified Canvas object.

createCheckbox

protected CheckboxPeer createCheckbox(Checkbox frontend)
Creates a peer object for the specified Checkbox.
Overrides:
createCheckbox in interface Toolkit
Parameters:
Returns:
The peer for the specified Checkbox object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createCheckboxMenuItem

protected CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem frontend)
Creates a peer object for the specified CheckboxMenuItem.
Overrides:
createCheckboxMenuItem in interface Toolkit
Parameters:
Returns:
The peer for the specified CheckboxMenuItem object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createChoice

protected ChoicePeer createChoice(Choice frontend)
Creates a peer object for the specified Choice.
Overrides:
createChoice in interface Toolkit
Parameters:
Returns:
The peer for the specified Choice object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createDialog

protected DialogPeer createDialog(Dialog frontend)
Creates a peer object for the specified Dialog.
Overrides:
createDialog in interface Toolkit
Parameters:
Returns:
The peer for the specified font name.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createDragGestureRecognizer

public DragGestureRecognizer createDragGestureRecognizer(Class<T> abstractRecognizerClass,
                                                         DragSource ds,
                                                         Component c,
                                                         int srcActions,
                                                         DragGestureListener dgl)

createDragSourceContextPeer

public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
            throws InvalidDnDOperationException
Overrides:
createDragSourceContextPeer in interface Toolkit
Since:
1.3

createEmbeddedWindow

public EmbeddedWindowPeer createEmbeddedWindow(EmbeddedWindow w)
Creates an embedded window peer, and associates it with an EmbeddedWindow object.
Overrides:
createEmbeddedWindow in interface ClasspathToolkit
Parameters:
w - The embedded window with which to associate a peer.

createFileDialog

protected FileDialogPeer createFileDialog(FileDialog frontend)
Creates a peer object for the specified FileDialog.
Overrides:
createFileDialog in interface Toolkit
Parameters:
Returns:
The peer for the specified FileDialog object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createFont

public Font createFont(int format,
                       InputStream stream)
Creates a font, reading the glyph definitions from a stream.

This method provides the platform-specific implementation for the static factory method Font.createFont(int,InputStream).

Overrides:
createFont in interface ClasspathToolkit
Parameters:
format - the format of the font data, such as Font.TRUETYPE_FONT. An implementation may ignore this argument if it is able to automatically recognize the font format from the provided data.
stream - an input stream from where the font data is read in. The stream will be advanced to the position after the font data, but not closed.
Throws:
IllegalArgumentException - if format is not supported.

createFrame

protected FramePeer createFrame(Frame frontend)
Creates a peer object for the specified Frame.
Overrides:
createFrame in interface Toolkit
Parameters:
Returns:
The peer for the specified Frame object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createImage

public Image createImage(byte[] imagedata,
                         int imageoffset,
                         int imagelength)
Creates an image from the specified portion of the byte array passed. The array must be in a recognized format. Supported formats vary from toolkit to toolkit.
Overrides:
createImage in interface Toolkit
Parameters:
Returns:
The created image.

createImage

public Image createImage(ImageProducer producer)
Creates an image using the specified ImageProducer
Overrides:
createImage in interface Toolkit
Parameters:
producer - The ImageProducer to create the image from.
Returns:
The created image.

createImage

public Image createImage(String filename)
Overrides:
createImage in interface Toolkit

createImage

public Image createImage(URL url)
Overrides:
createImage in interface Toolkit

createLabel

protected LabelPeer createLabel(Label frontend)
Creates a peer object for the specified Label.
Overrides:
createLabel in interface Toolkit
Parameters:
Returns:
The peer for the specified Label object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createList

protected ListPeer createList(List frontend)
Creates a peer object for the specified List.
Overrides:
createList in interface Toolkit
Parameters:
Returns:
The peer for the specified List object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createMenu

protected MenuPeer createMenu(Menu frontend)
Creates a peer object for the specified Menu.
Overrides:
createMenu in interface Toolkit
Parameters:
Returns:
The peer for the specified Menu object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createMenuBar

protected MenuBarPeer createMenuBar(MenuBar frontend)
Creates a peer object for the specified MenuBar.
Overrides:
createMenuBar in interface Toolkit
Parameters:
Returns:
The peer for the specified MenuBar object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createMenuItem

protected MenuItemPeer createMenuItem(MenuItem frontend)
Creates a peer object for the specified MenuItem.
Overrides:
createMenuItem in interface Toolkit
Parameters:
Returns:
The peer for the specified MenuItem object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createPanel

protected PanelPeer createPanel(Panel frontend)
Creates a peer object for the specified Panel.
Overrides:
createPanel in interface Toolkit
Parameters:
Returns:
The peer for the specified Panel object.

createPopupMenu

protected PopupMenuPeer createPopupMenu(PopupMenu frontend)
Creates a peer object for the specified PopupMenu.
Overrides:
createPopupMenu in interface Toolkit
Parameters:
Returns:
The peer for the specified PopupMenu object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createRobot

public RobotPeer createRobot(GraphicsDevice screen)
            throws AWTException
Creates a RobotPeer on a given GraphicsDevice.
Overrides:
createRobot in interface ClasspathToolkit

createScrollPane

protected ScrollPanePeer createScrollPane(ScrollPane frontend)
Creates a peer object for the specified ScrollPane.
Overrides:
createScrollPane in interface Toolkit
Parameters:
Returns:
The peer for the specified ScrollPane object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createScrollbar

protected ScrollbarPeer createScrollbar(Scrollbar frontend)
Creates a peer object for the specified Scrollbar.
Overrides:
createScrollbar in interface Toolkit
Parameters:
Returns:
The peer for the specified Scrollbar object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createTextArea

protected TextAreaPeer createTextArea(TextArea frontend)
Creates a peer object for the specified TextArea.
Overrides:
createTextArea in interface Toolkit
Parameters:
Returns:
The peer for the specified TextArea object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createTextField

protected TextFieldPeer createTextField(TextField frontend)
Creates a peer object for the specified TextField.
Overrides:
createTextField in interface Toolkit
Parameters:
Returns:
The peer for the specified TextField object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

createWindow

protected WindowPeer createWindow(Window frontend)
Creates a peer object for the specified Window.
Overrides:
createWindow in interface Toolkit
Parameters:
Returns:
The peer for the specified Window object.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

flushIfIdle

public void flushIfIdle()

getClasspathFontPeer

public ClasspathFontPeer getClasspathFontPeer(String name,
                                              Map<K,V> attrs)
Acquires an appropriate ClasspathFontPeer, for use in classpath's implementation of Font.
Parameters:
name - The logical name of the font. This may be either a face name or a logical font name, or may even be null. A default implementation of name decoding is provided in ClasspathFontPeer, but may be overridden in other toolkits.
attrs - Any extra TextAttribute attributes this font peer should have, such as size, weight, family name, or transformation.

getColorModel

public ColorModel getColorModel()
Returns the color model of the screen.
Overrides:
getColorModel in interface Toolkit
Returns:
The color model of the screen.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getFontList

public String[] getFontList()

Deprecated.

Returns the names of the available fonts.
Overrides:
getFontList in interface Toolkit
Returns:
The names of the available fonts.

getFontMetrics

public FontMetrics getFontMetrics(Font font)

Deprecated.

Return the font metrics for the specified font
Overrides:
getFontMetrics in interface Toolkit
Parameters:
Returns:
The requested font metrics.

getFontPeer

protected FontPeer getFontPeer(String name,
                               int style)

Deprecated.

Creates a peer object for the specified font name.
Overrides:
getFontPeer in interface Toolkit
Parameters:
name - The font to create the peer for.
style - The font style to create the peer for.
Returns:
The peer for the specified font name.

getImage

public Image getImage(String filename)
Returns an image from the specified file, which must be in a recognized format. Supported formats vary from toolkit to toolkit.
Overrides:
getImage in interface Toolkit
Returns:
name The name of the file to read the image from.

getImage

public Image getImage(URL url)
Returns an image from the specified URL, which must be in a recognized format. Supported formats vary from toolkit to toolkit.
Overrides:
getImage in interface Toolkit
Returns:
url The URl to read the image from.

getLocalGraphicsEnvironment

public GraphicsEnvironment getLocalGraphicsEnvironment()
Returns a shared instance of the local, platform-specific graphics environment.

This method is specific to GNU Classpath. It gets called by the Classpath implementation of GraphicsEnvironment.getLocalGraphcisEnvironment().

Overrides:
getLocalGraphicsEnvironment in interface ClasspathToolkit

getPrintJob

public PrintJob getPrintJob(Frame frame,
                            String title,
                            Properties props)
Returns a instance of PrintJob for the specified arguments.
Overrides:
getPrintJob in interface Toolkit
Parameters:
frame - The window initiating the print job.
title - The print job title.
props - The print job properties.
Returns:
The requested print job, or null if the job was cancelled.
Throws:
NullPointerException - If frame is null, or GraphicsEnvironment.isHeadless() returns true.
SecurityException - If this thread is not allowed to initiate a print job request.

getScreenResolution

public int getScreenResolution()
Returns the screen resolution in dots per square inch.
Overrides:
getScreenResolution in interface Toolkit
Returns:
The screen resolution in dots per square inch.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getScreenSize

public Dimension getScreenSize()
Returns the dimensions of the screen in pixels.
Overrides:
getScreenSize in interface Toolkit
Returns:
The dimensions of the screen in pixels.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getSystemClipboard

public Clipboard getSystemClipboard()
Returns the system clipboard.
Overrides:
getSystemClipboard in interface Toolkit
Returns:
THe system clipboard.
Throws:
HeadlessException - If GraphicsEnvironment.isHeadless() is true.

getSystemEventQueueImpl

protected EventQueue getSystemEventQueueImpl()
Returns the event queue that is suitable for the calling context.

Despite the word “System” in the name of this method, a toolkit may provide different event queues for each applet. There is no guarantee that the same queue is shared system-wide.

No security checks are performed, which is why this method may only be called by Toolkits.

Overrides:
getSystemEventQueueImpl in interface Toolkit

isModalExclusionTypeSupported

public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType)
Overrides:
isModalExclusionTypeSupported in interface Toolkit

isModalityTypeSupported

public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
Overrides:
isModalityTypeSupported in interface Toolkit

iterateNativeQueue

public void iterateNativeQueue(EventQueue locked,
                               boolean block)
Checks the native event queue for events. If blocking, waits until an event is available before returning, unless interrupted by wakeNativeQueue. If non-blocking, returns immediately even if no event is available.
Parameters:
locked - The calling EventQueue
block - If true, waits for a native event before returning

mapInputMethodHighlight

public Map<K,V> mapInputMethodHighlight(InputMethodHighlight highlight)
Overrides:
mapInputMethodHighlight in interface Toolkit
Since:
1.3

nativeQueueEmpty

public boolean nativeQueueEmpty()

prepareImage

public boolean prepareImage(Image image,
                            int width,
                            int height,
                            ImageObserver observer)
Readies an image to be rendered on the screen. The width and height values can be set to the default sizes for the image by passing -1 in those parameters.
Overrides:
prepareImage in interface Toolkit
Parameters:
image - The image to prepare for rendering.
width - The width of the image.
height - The height of the image.
observer - The observer to receive events about the preparation process.
Returns:
true if the image is already prepared for rendering, false otherwise.

setAlwaysOnTop

public void setAlwaysOnTop(boolean b)

sync

public void sync()
Flushes any buffered data to the screen so that it is in sync with what the AWT system has drawn to it.
Overrides:
sync in interface Toolkit

wakeNativeQueue

public void wakeNativeQueue()

Copyright (C) 2000, 2002, 2003, 2005 Free Software Foundation This file is part of libgcj. This software is copyrighted work licensed under the terms of the Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details.