| JavaTM 2 Platform Std. Ed. v1.6.0
java.awt
Class Toolkit
java.lang.Object
java.awt.Toolkit
public abstract class Toolkit - extends Object
This class is the abstract superclass of all actual
implementations of the Abstract Window Toolkit. Subclasses of
Toolkit are used to bind the various components
to particular native toolkit implementations.
Many GUI operations may be performed asynchronously. This
means that if you set the state of a component, and then
immediately query the state, the returned value may not yet
reflect the requested change. This includes, but is not
limited to:
- Scrolling to a specified position.
For example, calling ScrollPane.setScrollPosition
and then getScrollPosition may return an incorrect
value if the original request has not yet been processed.
- Moving the focus from one component to another.
For more information, see
Timing
Focus Transfers, a section in
The Swing
Tutorial.
- Making a top-level container visible.
Calling setVisible(true) on a Window,
Frame or Dialog may occur
asynchronously.
- Setting the size or location of a top-level container.
Calls to setSize, setBounds or
setLocation on a Window,
Frame or Dialog are forwarded
to the underlying window management system and may be
ignored or modified. See Window for
more information.
Most applications should not call any of the methods in this
class directly. The methods defined by Toolkit are
the "glue" that joins the platform-independent classes in the
java.awt package with their counterparts in
java.awt.peer. Some methods defined by
Toolkit query the native operating system directly.
- Since:
- JDK1.0
|
Method Summary |
void |
addAWTEventListener(AWTEventListener listener,
long eventMask)
Adds an AWTEventListener to receive all AWTEvents dispatched
system-wide that conform to the given eventMask. |
void |
addPropertyChangeListener(String name,
PropertyChangeListener pcl)
Adds the specified property change listener for the named desktop
property. |
abstract void |
beep()
Emits an audio beep. |
abstract int |
checkImage(Image image,
int width,
int height,
ImageObserver observer)
Indicates the construction status of a specified image that is
being prepared for display. |
protected abstract java.awt.peer.ButtonPeer |
createButton(Button target)
Creates this toolkit's implementation of Button using
the specified peer interface. |
protected abstract java.awt.peer.CanvasPeer |
createCanvas(Canvas target)
Creates this toolkit's implementation of Canvas using
the specified peer interface. |
protected abstract java.awt.peer.CheckboxPeer |
createCheckbox(Checkbox target)
Creates this toolkit's implementation of Checkbox using
the specified peer interface. |
protected abstract java.awt.peer.CheckboxMenuItemPeer |
createCheckboxMenuItem(CheckboxMenuItem target)
Creates this toolkit's implementation of CheckboxMenuItem using
the specified peer interface. |
protected abstract java.awt.peer.ChoicePeer |
createChoice(Choice target)
Creates this toolkit's implementation of Choice using
the specified peer interface. |
protected java.awt.peer.LightweightPeer |
createComponent(Component target)
Creates a peer for a component or container. |
Cursor |
createCustomCursor(Image cursor,
Point hotSpot,
String name)
Creates a new custom cursor object. |
protected abstract java.awt.peer.DesktopPeer |
createDesktopPeer(Desktop target)
Creates this toolkit's implementation of the Desktop
using the specified peer interface. |
protected abstract java.awt.peer.DialogPeer |
createDialog(Dialog target)
Creates this toolkit's implementation of Dialog using
the specified peer interface. |
|
createDragGestureRecognizer(Class<T> abstractRecognizerClass,
DragSource ds,
Component c,
int srcActions,
DragGestureListener dgl)
Creates a concrete, platform dependent, subclass of the abstract
DragGestureRecognizer class requested, and associates it with the
DragSource, Component and DragGestureListener specified. |
abstract java.awt.dnd.peer.DragSourceContextPeer |
createDragSourceContextPeer(DragGestureEvent dge)
Creates the peer for a DragSourceContext. |
protected abstract java.awt.peer.FileDialogPeer |
createFileDialog(FileDialog target)
Creates this toolkit's implementation of FileDialog using
the specified peer interface. |
protected abstract java.awt.peer.FramePeer |
createFrame(Frame target)
Creates this toolkit's implementation of Frame using
the specified peer interface. |
Image |
createImage(byte[] imagedata)
Creates an image which decodes the image stored in the specified
byte array. |
abstract Image |
createImage(byte[] imagedata,
int imageoffset,
int imagelength)
Creates an image which decodes the image stored in the specified
byte array, and at the specified offset and length. |
abstract Image |
createImage(ImageProducer producer)
Creates an image with the specified image producer. |
abstract Image |
createImage(String filename)
Returns an image which gets pixel data from the specified file. |
abstract Image |
createImage(URL url)
Returns an image which gets pixel data from the specified URL. |
protected abstract java.awt.peer.LabelPeer |
createLabel(Label target)
Creates this toolkit's implementation of Label using
the specified peer interface. |
protected abstract java.awt.peer.ListPeer |
createList(List target)
Creates this toolkit's implementation of List using
the specified peer interface. |
protected abstract java.awt.peer.MenuPeer |
createMenu(Menu target)
Creates this toolkit's implementation of Menu using
the specified peer interface. |
protected abstract java.awt.peer.MenuBarPeer |
createMenuBar(MenuBar target)
Creates this toolkit's implementation of MenuBar using
the specified peer interface. |
protected abstract java.awt.peer.MenuItemPeer |
createMenuItem(MenuItem target)
Creates this toolkit's implementation of MenuItem using
the specified peer interface. |
protected abstract java.awt.peer.PanelPeer |
createPanel(Panel target)
Creates this toolkit's implementation of Panel using
the specified peer interface. |
protected abstract java.awt.peer.PopupMenuPeer |
createPopupMenu(PopupMenu target)
Creates this toolkit's implementation of PopupMenu using
the specified peer interface. |
protected abstract java.awt.peer.ScrollbarPeer |
createScrollbar(Scrollbar target)
Creates this toolkit's implementation of Scrollbar using
the specified peer interface. |
protected abstract java.awt.peer.ScrollPanePeer |
createScrollPane(ScrollPane target)
Creates this toolkit's implementation of ScrollPane using
the specified peer interface. |
protected abstract java.awt.peer.TextAreaPeer |
createTextArea(TextArea target)
Creates this toolkit's implementation of TextArea using
the specified peer interface. |
protected abstract java.awt.peer.TextFieldPeer |
createTextField(TextField target)
Creates this toolkit's implementation of TextField using
the specified peer interface. |
protected abstract java.awt.peer.WindowPeer |
createWindow(Window target)
Creates this toolkit's implementation of Window using
the specified peer interface. |
AWTEventListener[] |
getAWTEventListeners()
Returns an array of all the AWTEventListeners
registered on this toolkit. |
AWTEventListener[] |
getAWTEventListeners(long eventMask)
Returns an array of all the AWTEventListeners
registered on this toolkit which listen to all of the event
types specified in the eventMask argument. |
Dimension |
getBestCursorSize(int preferredWidth,
int preferredHeight)
Returns the supported cursor dimension which is closest to the desired
sizes. |
abstract ColorModel |
getColorModel()
Determines the color model of this toolkit's screen. |
static Toolkit |
getDefaultToolkit()
Gets the default toolkit. |
Object |
getDesktopProperty(String propertyName)
Obtains a value for the specified desktop property. |
abstract String[] |
getFontList()
Deprecated. see GraphicsEnvironment.getAvailableFontFamilyNames() |
abstract FontMetrics |
getFontMetrics(Font font)
Deprecated. As of JDK version 1.2, replaced by the Font
method getLineMetrics. |
protected abstract java.awt.peer.FontPeer |
getFontPeer(String name,
int style)
Deprecated. see java.awt.GraphicsEnvironment#getAllFonts |
abstract Image |
getImage(String filename)
Returns an image which gets pixel data from the specified file,
whose format can be either GIF, JPEG or PNG. |
abstract Image |
getImage(URL url)
Returns an image which gets pixel data from the specified URL. |
boolean |
getLockingKeyState(int keyCode)
Returns whether the given locking key on the keyboard is currently in
its "on" state. |
int |
getMaximumCursorColors()
Returns the maximum number of colors the Toolkit supports in a custom cursor
palette. |
int |
getMenuShortcutKeyMask()
Determines which modifier key is the appropriate accelerator
key for menu shortcuts. |
protected java.awt.peer.MouseInfoPeer |
getMouseInfoPeer()
Obtains this toolkit's implementation of helper class for
MouseInfo operations. |
protected static Container |
getNativeContainer(Component c)
Give native peers the ability to query the native container
given a native component (eg the direct parent may be lightweight). |
PrintJob |
getPrintJob(Frame frame,
String jobtitle,
JobAttributes jobAttributes,
PageAttributes pageAttributes)
Gets a PrintJob object which is the result of initiating
a print operation on the toolkit's platform. |
abstract PrintJob |
getPrintJob(Frame frame,
String jobtitle,
Properties props)
Gets a PrintJob object which is the result of initiating
a print operation on the toolkit's platform. |
static String |
getProperty(String key,
String defaultValue)
Gets a property with the specified key and default. |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the property change listeners
registered on this toolkit. |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
Returns an array of all the PropertyChangeListeners
associated with the named property. |
Insets |
getScreenInsets(GraphicsConfiguration gc)
Gets the insets of the screen. |
abstract int |
getScreenResolution()
Returns the screen resolution in dots-per-inch. |
abstract Dimension |
getScreenSize()
Gets the size of the screen. |
abstract Clipboard |
getSystemClipboard()
Gets the singleton instance of the system Clipboard which interfaces
with clipboard facilities provided by the native platform. |
EventQueue |
getSystemEventQueue()
Get the application's or applet's EventQueue instance. |
protected abstract EventQueue |
getSystemEventQueueImpl()
Gets the application's or applet's EventQueue
instance, without checking access. |
Clipboard |
getSystemSelection()
Gets the singleton instance of the system selection as a
Clipboard object. |
protected void |
initializeDesktopProperties()
initializeDesktopProperties |
boolean |
isAlwaysOnTopSupported()
Returns whether the always-on-top mode is supported by this toolkit. |
boolean |
isDynamicLayoutActive()
Returns whether dynamic layout of Containers on resize is
currently active (both set programmatically, and supported
by the underlying operating system and/or window manager). |
protected boolean |
isDynamicLayoutSet()
Returns whether the layout of Containers is validated dynamically
during resizing, or statically, after resizing is complete. |
boolean |
isFrameStateSupported(int state)
Returns whether Toolkit supports this state for
Frames. |
abstract boolean |
isModalExclusionTypeSupported(Dialog.ModalExclusionType modalExclusionType)
Returns whether the given modal exclusion type is supported by this
toolkit. |
abstract boolean |
isModalityTypeSupported(Dialog.ModalityType modalityType)
Returns whether the given modality type is supported by this toolkit. |
protected Object |
lazilyLoadDesktopProperty(String name)
an opportunity to lazily evaluate desktop property values. |
protected void |
loadSystemColors(int[] systemColors)
Fills in the integer array that is supplied as an argument
with the current system color values. |
abstract Map<TextAttribute,?> |
mapInputMethodHighlight(InputMethodHighlight highlight)
Returns a map of visual attributes for the abstract level description
of the given input method highlight, or null if no mapping is found. |
abstract boolean |
prepareImage(Image image,
int width,
int height,
ImageObserver observer)
Prepares an image for rendering. |
void |
removeAWTEventListener(AWTEventListener listener)
Removes an AWTEventListener from receiving dispatched AWTEvents. |
void |
removePropertyChangeListener(String name,
PropertyChangeListener pcl)
Removes the specified property change listener for the named
desktop property. |
protected void |
setDesktopProperty(String name,
Object newValue)
Sets the named desktop property to the specified value and fires a
property change event to notify any listeners that the value has changed. |
void |
setDynamicLayout(boolean dynamic)
Controls whether the layout of Containers is validated dynamically
during resizing, or statically, after resizing is complete. |
void |
setLockingKeyState(int keyCode,
boolean on)
Sets the state of the given locking key on the keyboard. |
abstract void |
sync()
Synchronizes this toolkit's graphics state. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
desktopProperties
protected final Map<String,Object> desktopProperties
desktopPropsSupport
protected final PropertyChangeSupport desktopPropsSupport
Toolkit
public Toolkit()
createDesktopPeer
protected abstract java.awt.peer.DesktopPeer createDesktopPeer(Desktop target)
throws HeadlessException
- Creates this toolkit's implementation of the
Desktop
using the specified peer interface.
- Parameters:
target - the desktop to be implemented
- Returns:
- this toolkit's implementation of the
Desktop
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- 1.6
- See Also:
GraphicsEnvironment.isHeadless(),
Desktop,
DesktopPeer
createButton
protected abstract java.awt.peer.ButtonPeer createButton(Button target)
throws HeadlessException
- Creates this toolkit's implementation of
Button using
the specified peer interface.
- Parameters:
target - the button to be implemented.
- Returns:
- this toolkit's implementation of
Button.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Button,
ButtonPeer
createTextField
protected abstract java.awt.peer.TextFieldPeer createTextField(TextField target)
throws HeadlessException
- Creates this toolkit's implementation of
TextField using
the specified peer interface.
- Parameters:
target - the text field to be implemented.
- Returns:
- this toolkit's implementation of
TextField.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
TextField,
TextFieldPeer
createLabel
protected abstract java.awt.peer.LabelPeer createLabel(Label target)
throws HeadlessException
- Creates this toolkit's implementation of
Label using
the specified peer interface.
- Parameters:
target - the label to be implemented.
- Returns:
- this toolkit's implementation of
Label.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Label,
LabelPeer
createList
protected abstract java.awt.peer.ListPeer createList(List target)
throws HeadlessException
- Creates this toolkit's implementation of
List using
the specified peer interface.
- Parameters:
target - the list to be implemented.
- Returns:
- this toolkit's implementation of
List.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
List,
ListPeer
createCheckbox
protected abstract java.awt.peer.CheckboxPeer createCheckbox(Checkbox target)
throws HeadlessException
- Creates this toolkit's implementation of
Checkbox using
the specified peer interface.
- Parameters:
target - the check box to be implemented.
- Returns:
- this toolkit's implementation of
Checkbox.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Checkbox,
CheckboxPeer
createScrollbar
protected abstract java.awt.peer.ScrollbarPeer createScrollbar(Scrollbar target)
throws HeadlessException
- Creates this toolkit's implementation of
Scrollbar using
the specified peer interface.
- Parameters:
target - the scroll bar to be implemented.
- Returns:
- this toolkit's implementation of
Scrollbar.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Scrollbar,
ScrollbarPeer
createScrollPane
protected abstract java.awt.peer.ScrollPanePeer createScrollPane(ScrollPane target)
throws HeadlessException
- Creates this toolkit's implementation of
ScrollPane using
the specified peer interface.
- Parameters:
target - the scroll pane to be implemented.
- Returns:
- this toolkit's implementation of
ScrollPane.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- JDK1.1
- See Also:
GraphicsEnvironment.isHeadless(),
ScrollPane,
ScrollPanePeer
createTextArea
protected abstract java.awt.peer.TextAreaPeer createTextArea(TextArea target)
throws HeadlessException
- Creates this toolkit's implementation of
TextArea using
the specified peer interface.
- Parameters:
target - the text area to be implemented.
- Returns:
- this toolkit's implementation of
TextArea.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
TextArea,
TextAreaPeer
createChoice
protected abstract java.awt.peer.ChoicePeer createChoice(Choice target)
throws HeadlessException
- Creates this toolkit's implementation of
Choice using
the specified peer interface.
- Parameters:
target - the choice to be implemented.
- Returns:
- this toolkit's implementation of
Choice.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Choice,
ChoicePeer
createFrame
protected abstract java.awt.peer.FramePeer createFrame(Frame target)
throws HeadlessException
- Creates this toolkit's implementation of
Frame using
the specified peer interface.
- Parameters:
target - the frame to be implemented.
- Returns:
- this toolkit's implementation of
Frame.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Frame,
FramePeer
createCanvas
protected abstract java.awt.peer.CanvasPeer createCanvas(Canvas target)
- Creates this toolkit's implementation of
Canvas using
the specified peer interface.
- Parameters:
target - the canvas to be implemented.
- Returns:
- this toolkit's implementation of
Canvas. - See Also:
Canvas,
CanvasPeer
createPanel
protected abstract java.awt.peer.PanelPeer createPanel(Panel target)
- Creates this toolkit's implementation of
Panel using
the specified peer interface.
- Parameters:
target - the panel to be implemented.
- Returns:
- this toolkit's implementation of
Panel. - See Also:
Panel,
PanelPeer
createWindow
protected abstract java.awt.peer.WindowPeer createWindow(Window target)
throws HeadlessException
- Creates this toolkit's implementation of
Window using
the specified peer interface.
- Parameters:
target - the window to be implemented.
- Returns:
- this toolkit's implementation of
Window.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Window,
WindowPeer
createDialog
protected abstract java.awt.peer.DialogPeer createDialog(Dialog target)
throws HeadlessException
- Creates this toolkit's implementation of
Dialog using
the specified peer interface.
- Parameters:
target - the dialog to be implemented.
- Returns:
- this toolkit's implementation of
Dialog.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Dialog,
DialogPeer
createMenuBar
protected abstract java.awt.peer.MenuBarPeer createMenuBar(MenuBar target)
throws HeadlessException
- Creates this toolkit's implementation of
MenuBar using
the specified peer interface.
- Parameters:
target - the menu bar to be implemented.
- Returns:
- this toolkit's implementation of
MenuBar.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
MenuBar,
MenuBarPeer
createMenu
protected abstract java.awt.peer.MenuPeer createMenu(Menu target)
throws HeadlessException
- Creates this toolkit's implementation of
Menu using
the specified peer interface.
- Parameters:
target - the menu to be implemented.
- Returns:
- this toolkit's implementation of
Menu.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
Menu,
MenuPeer
createPopupMenu
protected abstract java.awt.peer.PopupMenuPeer createPopupMenu(PopupMenu target)
throws HeadlessException
- Creates this toolkit's implementation of
PopupMenu using
the specified peer interface.
- Parameters:
target - the popup menu to be implemented.
- Returns:
- this toolkit's implementation of
PopupMenu.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- JDK1.1
- See Also:
GraphicsEnvironment.isHeadless(),
PopupMenu,
PopupMenuPeer
createMenuItem
protected abstract java.awt.peer.MenuItemPeer createMenuItem(MenuItem target)
throws HeadlessException
- Creates this toolkit's implementation of
MenuItem using
the specified peer interface.
- Parameters:
target - the menu item to be implemented.
- Returns:
- this toolkit's implementation of
MenuItem.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
MenuItem,
MenuItemPeer
createFileDialog
protected abstract java.awt.peer.FileDialogPeer createFileDialog(FileDialog target)
throws HeadlessException
- Creates this toolkit's implementation of
FileDialog using
the specified peer interface.
- Parameters:
target - the file dialog to be implemented.
- Returns:
- this toolkit's implementation of
FileDialog.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
FileDialog,
FileDialogPeer
createCheckboxMenuItem
protected abstract java.awt.peer.CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
throws HeadlessException
- Creates this toolkit's implementation of
CheckboxMenuItem using
the specified peer interface.
- Parameters:
target - the checkbox menu item to be implemented.
- Returns:
- this toolkit's implementation of
CheckboxMenuItem.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
CheckboxMenuItem,
CheckboxMenuItemPeer
getMouseInfoPeer
protected java.awt.peer.MouseInfoPeer getMouseInfoPeer()
- Obtains this toolkit's implementation of helper class for
MouseInfo operations.
- Returns:
- this toolkit's implementation of helper for
MouseInfo
- Throws:
UnsupportedOperationException - if this operation is not implemented- Since:
- 1.5
- See Also:
MouseInfoPeer,
MouseInfo
createComponent
protected java.awt.peer.LightweightPeer createComponent(Component target)
- Creates a peer for a component or container. This peer is windowless
and allows the Component and Container classes to be extended directly
to create windowless components that are defined entirely in java.
- Parameters:
target - The Component to be created.
getFontPeer
@Deprecated
protected abstract java.awt.peer.FontPeer getFontPeer(String name,
int style)
- Deprecated. see java.awt.GraphicsEnvironment#getAllFonts
- Creates this toolkit's implementation of
Font using
the specified peer interface.
- Parameters:
name - the font to be implementedstyle - the style of the font, such as PLAIN,
BOLD, ITALIC, or a combination
- Returns:
- this toolkit's implementation of
Font - See Also:
Font,
FontPeer,
GraphicsEnvironment.getAllFonts()
loadSystemColors
protected void loadSystemColors(int[] systemColors)
throws HeadlessException
- Fills in the integer array that is supplied as an argument
with the current system color values.
- Parameters:
systemColors - an integer array.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- JDK1.1
- See Also:
GraphicsEnvironment.isHeadless()
setDynamicLayout
public void setDynamicLayout(boolean dynamic)
throws HeadlessException
- Controls whether the layout of Containers is validated dynamically
during resizing, or statically, after resizing is complete.
Note that this feature is not supported on all platforms, and
conversely, that this feature cannot be turned off on some platforms.
On platforms where dynamic layout during resize is not supported
(or is always supported), setting this property has no effect.
Note that this feature can be set or unset as a property of the
operating system or window manager on some platforms. On such
platforms, the dynamic resize property must be set at the operating
system or window manager level before this method can take effect.
This method does not change the underlying operating system or
window manager support or settings. The OS/WM support can be
queried using getDesktopProperty("awt.dynamicLayoutSupported").
- Parameters:
dynamic - If true, Containers should re-layout their
components as the Container is being resized. If false,
the layout will be validated after resizing is finished.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- 1.4
- See Also:
isDynamicLayoutSet(),
isDynamicLayoutActive(),
getDesktopProperty(String propertyName),
GraphicsEnvironment.isHeadless()
isDynamicLayoutSet
protected boolean isDynamicLayoutSet()
throws HeadlessException
- Returns whether the layout of Containers is validated dynamically
during resizing, or statically, after resizing is complete.
Note: this method returns the value that was set programmatically;
it does not reflect support at the level of the operating system
or window manager for dynamic layout on resizing, or the current
operating system or window manager settings. The OS/WM support can
be queried using getDesktopProperty("awt.dynamicLayoutSupported").
- Returns:
- true if validation of Containers is done dynamically,
false if validation is done after resizing is finished.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- 1.4
- See Also:
setDynamicLayout(boolean dynamic),
isDynamicLayoutActive(),
getDesktopProperty(String propertyName),
GraphicsEnvironment.isHeadless()
isDynamicLayoutActive
public boolean isDynamicLayoutActive()
throws HeadlessException
- Returns whether dynamic layout of Containers on resize is
currently active (both set programmatically, and supported
by the underlying operating system and/or window manager).
The OS/WM support can be queried using
getDesktopProperty("awt.dynamicLayoutSupported").
- Returns:
- true if dynamic layout of Containers on resize is
currently active, false otherwise.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- 1.4
- See Also:
setDynamicLayout(boolean dynamic),
isDynamicLayoutSet(),
getDesktopProperty(String propertyName),
GraphicsEnvironment.isHeadless()
getScreenSize
public abstract Dimension getScreenSize()
throws HeadlessException
- Gets the size of the screen. On systems with multiple displays, the
primary display is used. Multi-screen aware display dimensions are
available from
GraphicsConfiguration and
GraphicsDevice.
- Returns:
- the size of this toolkit's screen, in pixels.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsConfiguration.getBounds(),
GraphicsDevice.getDisplayMode(),
GraphicsEnvironment.isHeadless()
getScreenResolution
public abstract int getScreenResolution()
throws HeadlessException
- Returns the screen resolution in dots-per-inch.
- Returns:
- this toolkit's screen resolution, in dots-per-inch.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless()
getScreenInsets
public Insets getScreenInsets(GraphicsConfiguration gc)
throws HeadlessException
- Gets the insets of the screen.
- Parameters:
gc - a GraphicsConfiguration
- Returns:
- the insets of this toolkit's screen, in pixels.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- Since:
- 1.4
- See Also:
GraphicsEnvironment.isHeadless()
getColorModel
public abstract ColorModel getColorModel()
throws HeadlessException
- Determines the color model of this toolkit's screen.
ColorModel is an abstract class that
encapsulates the ability to translate between the
pixel values of an image and its red, green, blue,
and alpha components.
This toolkit method is called by the
getColorModel method
of the Component class.
- Returns:
- the color model of this toolkit's screen.
- Throws:
HeadlessException - if GraphicsEnvironment.isHeadless()
returns true- See Also:
GraphicsEnvironment.isHeadless(),
ColorModel,
Component.getColorModel()
getFontList
@Deprecated
public abstract String[] getFontList()
- Deprecated. see
GraphicsEnvironment.getAvailableFontFamilyNames()
- Returns the names of the available fonts in this toolkit.
For 1.1, the following font names are deprecated (the replacement
name follows):
- TimesRoman (use Serif)
- Helvetica (use SansSerif)
- Courier (use Monospaced)
The ZapfDingbats fontname is also deprecated in 1.1 but the characters
are defined in Unicode starting at 0x2700, and as of 1.1 Java supports
those characters.
- Returns:
- the names of the available fonts in this toolkit.
- See Also:
GraphicsEnvironment.getAvailableFontFamilyNames()
getFontMetrics
@Deprecated
public abstract FontMetrics getFontMetrics(Font font)
- Deprecated. As of JDK version 1.2, replaced by the
Font
method getLineMetrics.
- Gets the screen device metrics for rendering of the font.
- Parameters:
font - a font
- Returns:
- the screen metrics of the specified font in this toolkit
- See Also:
LineMetrics,
Font.getLineMetrics(java.lang.String, java.awt.font.FontRenderContext),
GraphicsEnvironment.getScreenDevices()
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. It is useful
for animation.
getDefaultToolkit
public static Toolkit getDefaultToolkit()
- Gets the default toolkit.
If a system property named "java.awt.headless" is set
to true then the headless implementation
of Toolkit is used.
If there is no "java.awt.headless" or it is set to
false and there is a system property named
"awt.toolkit",
that property is treated as the name of a class that is a subclass
of Toolkit;
otherwise the default platform-specific implementation of
Toolkit is used.
Also loads additional classes into the VM, using the property
'assistive_technologies' specified in the Sun reference
implementation by a line in the 'accessibility.properties'
file. The form is "assistive_technologies=..." where
the "..." is a comma-separated list of assistive technology
classes to load. Each class is loaded in the order given
and a single instance of each is created using
Class.forName(class).newInstance(). This is done just after
the AWT toolkit is created. All errors are handled via an
AWTError exception.
- Returns:
- the default toolkit.
- Throws:
AWTError - if a toolkit could not be found, or
if one could not be accessed or instantiated.
getImage
public abstract Image getImage(String filename)
- Returns an image which gets pixel data from the specified file,
whose format can be either GIF, JPEG or PNG.
The underlying toolkit attempts to resolve multiple requests
with the same filename to the same returned Image.
Since the mechanism required to facilitate this sharing of
Image objects may continue to hold onto images
that are no longer in use for an indefinite period of time,
developers are encouraged to implement their own caching of
images by using the createImage
variant wherever available.
If the image data contained in the specified file changes,
the Image object returned from this method may
still contain stale information which was loaded from the
file after a prior call.
Previously loaded image data can be manually discarded by
calling the flush method on the
returned Image.
This method first checks if there is a security manager installed.
If so, the method calls the security manager's
checkRead method with the file specified to ensure
that the access to the image is allowed.
- Parameters:
filename - the name of a file containing pixel data
in a recognized file format.
- Returns:
- an image which gets its pixel data from
the specified file.
- Throws:
SecurityException - if a security manager exists and its
checkRead method doesn't allow the operation.- See Also:
createImage(java.lang.String)
getImage
public abstract Image getImage(URL url)
- Returns an image which gets pixel data from the specified URL.
The pixel data referenced by the specified URL must be in one
of the following formats: GIF, JPEG or PNG.
The underlying toolkit attempts to resolve multiple requests
with the same URL to the same returned Image.
Since the mechanism required to facilitate this sharing of
Image objects may continue to hold onto images
that are no longer in use for an indefinite period of time,
developers are encouraged to implement their own caching of
images by using the createImage
variant wherever available.
If the image data stored at the specified URL changes,
the Image object returned from this method may
still contain stale information which was fetched from the
URL after a prior call.
Previously loaded image data can be manually discarded by
calling the flush method on the
returned Image.
This method first checks if there is a security manager installed.
If so, the method calls the security manager's
checkPermission method with the
url.openConnection().getPermission() permission to ensure
that the access to the image is allowed. For compatibility
with pre-1.2 security managers, if the access is denied with
FilePermission or SocketPermission,
the method throws the SecurityException
if the corresponding 1.1-style SecurityManager.checkXXX method
also denies permission.
- Parameters:
url - the URL to use in fetching the pixel data.
- Returns:
- an image which gets its pixel data from
the specified URL.
- Throws:
SecurityException - if a security manager exists and its
checkPermission method doesn't allow
the operation.- See Also:
createImage(java.net.URL)
createImage
public abstract Image createImage(String filename)
- Returns an image which gets pixel data from the specified file.
The returned Image is a new object which will not be shared
with any other caller of this method or its getImage variant.
This method first checks if there is a security manager installed.
If so, the method calls the security manager's
checkRead method with the specified file to ensure
that the image creation is allowed.
- Parameters:
filename - the name of a file containing pixel data
in a recognized file format.
- Returns:
- an image which gets its pixel data from
the specified file.
- Throws:
SecurityException - if a security manager exists and its
checkRead method doesn't allow the operation.- See Also:
getImage(java.lang.String)
createImage
public abstract |