站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class Toolkit - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

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.

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

Field Summary
protected  Map desktopProperties
           
protected  PropertyChangeSupport desktopPropsSupport
           
 
Constructor Summary
Toolkit()
           
 
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)
          add the specified property change listener for the named desktop property If pcl is null, no exception is thrown and no action is performed.
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.DialogPeer createDialog(Dialog target)
          Creates this toolkit's implementation of Dialog using the specified peer interface.
 DragGestureRecognizer createDragGestureRecognizer(Class abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl)
          create a concrete, platform dependent, subclass of the abstract DragGestureRecognizer class requested, and associate it with the DragSource, Component and DragGestureListener specified subclasses should override this to provide their own implementation
abstract  java.awt.dnd.peer.DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
          create 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.
 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)
          obtain a value for the specified desktop property.
abstract  String[] getFontList()
          Deprecated. see GraphicsEnvironment.getAvailableFontFamilyNames()
abstract  FontMetrics getFontMetrics(Font font)
          Deprecated. This returns integer metrics for the default screen.
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.
abstract  Image getImage(URL url)
          Returns an image which gets pixel data from the specified URL.
 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 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).
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.
abstract  int getScreenResolution()
          Returns the screen resolution in dots-per-inch.
abstract  Dimension getScreenSize()
          Gets the size of the screen.
abstract  Clipboard getSystemClipboard()
          Gets an 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()
           
protected  void initializeDesktopProperties()
          initializeDesktopProperties
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  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)
          remove the specified property change listener for the named desktop property If pcl is null, no exception is thrown and no action is performed.
protected  void setDesktopProperty(String name, Object newValue)
          set the named desktop property to the specified value and fire a property change event to notify any listeners that the value has changed
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
 

Field Detail

desktopProperties

protected final Map desktopProperties

desktopPropsSupport

protected final PropertyChangeSupport desktopPropsSupport
Constructor Detail

Toolkit

public Toolkit()
Method Detail

createButton

protected abstract java.awt.peer.ButtonPeer createButton(Button target)
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.
See Also:
Button, ButtonPeer

createTextField

protected abstract java.awt.peer.TextFieldPeer createTextField(TextField target)
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.
See Also:
TextField, TextFieldPeer

createLabel

protected abstract java.awt.peer.LabelPeer createLabel(Label target)
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.
See Also:
Label, LabelPeer

createList

protected abstract java.awt.peer.ListPeer createList(List target)
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.
See Also:
List, ListPeer

createCheckbox

protected abstract java.awt.peer.CheckboxPeer createCheckbox(Checkbox target)
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.
See Also:
Checkbox, CheckboxPeer

createScrollbar

protected abstract java.awt.peer.ScrollbarPeer createScrollbar(Scrollbar target)
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.
See Also:
Scrollbar, ScrollbarPeer

createScrollPane

protected abstract java.awt.peer.ScrollPanePeer createScrollPane(ScrollPane target)
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.
Since:
JDK1.1
See Also:
ScrollPane, ScrollPanePeer

createTextArea

protected abstract java.awt.peer.TextAreaPeer createTextArea(TextArea target)
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.
See Also:
TextArea, TextAreaPeer

createChoice

protected abstract java.awt.peer.ChoicePeer createChoice(Choice target)
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.
See Also:
Choice, ChoicePeer

createFrame

protected abstract java.awt.peer.FramePeer createFrame(Frame target)
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.
See Also:
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)
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.
See Also:
Window, WindowPeer

createDialog

protected abstract java.awt.peer.DialogPeer createDialog(Dialog target)
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.
See Also:
Dialog, DialogPeer

createMenuBar

protected abstract java.awt.peer.MenuBarPeer createMenuBar(MenuBar target)
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.
See Also:
MenuBar, MenuBarPeer

createMenu

protected abstract java.awt.peer.MenuPeer createMenu(Menu target)
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.
See Also:
Menu, MenuPeer

createPopupMenu

protected abstract java.awt.peer.PopupMenuPeer createPopupMenu(PopupMenu target)
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.
Since:
JDK1.1
See Also:
PopupMenu, PopupMenuPeer

createMenuItem

protected abstract java.awt.peer.MenuItemPeer createMenuItem(MenuItem target)
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.
See Also:
MenuItem, MenuItemPeer

createFileDialog

protected abstract java.awt.peer.FileDialogPeer createFileDialog(FileDialog target)
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.
See Also:
FileDialog, FileDialogPeer

createCheckboxMenuItem

protected abstract java.awt.peer.CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target)
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.
See Also:
CheckboxMenuItem, CheckboxMenuItemPeer

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

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:
target - the font to be implemented.
Returns:
this toolkit's implementation of Font.
See Also:
Font, FontPeer, GraphicsEnvironment.getAllFonts()

loadSystemColors

protected void loadSystemColors(int[] systemColors)
Fills in the integer array that is supplied as an argument with the current system color values.

This method is called by the method updateSystemColors in the SystemColor class.

Parameters:
an - integer array.
Since:
JDK1.1
See Also:
java.awt.SystemColor#updateSystemColors

getScreenSize

public abstract Dimension getScreenSize()
Gets the size of the screen.
Returns:
the size of this toolkit's screen, in pixels.

getScreenResolution

public abstract int getScreenResolution()
Returns the screen resolution in dots-per-inch.
Returns:
this toolkit's screen resolution, in dots-per-inch.

getColorModel

public abstract ColorModel getColorModel()
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.
See Also:
ColorModel, Component.getColorModel()

getFontList

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

public abstract FontMetrics getFontMetrics(Font font)
Deprecated. This returns integer metrics for the default screen.

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:
java.awt.Font#LineMetrics, java.awt.Font#retreiveLineMetrics,

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

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. 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 of use for an indefinate period of time, developers are encouraged to implement their own caching of images by using the createImage variant wherever available.
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.
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 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 of use for an indefinate period of time, developers are encouraged to implement their own caching of images by using the createImage variant wherever available.
Parameters:
url - the URL to use in fetching the pixel data.
Returns:
an image which gets its pixel data from the specified URL.
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.
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.
See Also:
getImage(java.lang.String)

createImage

public abstract Image createImage(URL url)
Returns an image which gets pixel data from the specified URL. The returned Image is a new object which will not be shared with any other caller of this method or its getImage variant.
Parameters:
url - the URL to use in fetching the pixel data.
Returns:
an image which gets its pixel data from the specified URL.
See Also:
getImage(java.net.URL)

prepareImage

public abstract boolean prepareImage(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:
Component.prepareImage(java.awt.Image, java.awt.image.ImageObserver), Component.prepareImage(java.awt.Image, int, int, java.awt.image.ImageObserver), ImageObserver

checkImage

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

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(java.awt.Image, int, int, java.awt.image.ImageObserver), Component.checkImage(java.awt.Image, java.awt.image.ImageObserver), Component.checkImage(java.awt.Image, int, int, java.awt.image.ImageObserver), ImageObserver

createImage

public abstract Image createImage(ImageProducer producer)
Creates an image with the specified image producer.
Parameters:
producer - the image producer to be used.
Returns:
an image with the specified image producer.
See Also:
Image, ImageProducer, Component.createImage(java.awt.image.ImageProducer)

createImage

public Image createImage(byte[] imagedata)
Creates an image which decodes the image stored in the specified byte array.

The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.

Parameters:
imagedata - an array of bytes, representing image data in a supported image format.
Returns:
an image.
Since:
JDK1.1

createImage

public 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. The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.
Parameters:
imagedata - an array of bytes, representing image data in a supported image format.
imageoffset - the offset of the beginning of the data in the array.
imagelength - the length of the data in the array.
Returns:
an image.
Since:
JDK1.1

getPrintJob

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

Each actual implementation of this method should first check if there is a security manager installed. If there is, the method should call the security manager's checkPrintJobAccess method to ensure initiation of a print operation is allowed. If the default implementation of checkPrintJobAccess is used (that is, that method is not overriden), then this results in a call to the security manager's checkPermission method with a RuntimePermission("queuePrintJob") permission.

Returns:
a PrintJob object, or null if the user cancelled the print job.
Since:
JDK1.1
See Also:
PrintJob, RuntimePermission

beep

public abstract void beep()
Emits an audio beep.
Since:
JDK1.1

getSystemClipboard

public abstract Clipboard getSystemClipboard()
Gets an instance of the system clipboard which interfaces with clipboard facilities provided by the native platform.

This clipboard enables data transfer between Java programs and native applications which use native clipboard facilities.

Each actual implementation of this method should first check if there is a security manager installed. If there is, the method should call the security manager's checkSystemClipboardAccess method to ensure it's ok to to access the system clipboard. If the default implementation of checkSystemClipboardAccess is used (that is, that method is not overriden), then this results in a call to the security manager's checkPermission method with an AWTPermission("accessClipboard") permission.

Returns:
an instance of the system clipboard.
Since:
JDK1.1
See Also:
Clipboard, AWTPermission

getMenuShortcutKeyMask

public int getMenuShortcutKeyMask()
Determines which modifier key is the appropriate accelerator key for menu shortcuts.

Menu shortcuts, which are embodied in the MenuShortcut class, are handled by the MenuBar class.

By default, this method returns Event.CTRL_MASK. Toolkit implementations should override this method if the Control key isn't the correct key for accelerators.

Returns:
the modifier mask on the Event class that is used for menu shortcuts on this toolkit.
Since:
JDK1.1
See Also:
MenuBar, MenuShortcut

getNativeContainer

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

createCustomCursor

public Cursor createCustomCursor(Image cursor,
                                 Point hotSpot,
                                 String name)
                          throws IndexOutOfBoundsException
Creates a new custom cursor object.
Parameters:
image - the image to display when the cursor is active.
hotSpot - the X and Y of the large cursor's hot spot. The hotSpot values must be less than the Dimension returned by getBestCursorSize().
name - a localized description of the cursor, for Java Accessibility use.
Throws:
IndexOutOfBoundsException - if the hotSpot values are outside the bounds of the cursor.
Since:
JDK1.2

getBestCursorSize

public Dimension getBestCursorSize(int preferredWidth,
                                   int preferredHeight)
Returns the supported cursor dimension which is closest to the desired sizes. Systems which only support a single cursor size will return that size regardless of the desired sizes. Systems which don't support custom cursors will return a dimension of 0, 0.

Note: if an image is used whose dimensions don't match a supported size (as returned by this method), the Toolkit implementation will attempt to resize the image to a supported size. Since converting low-resolution images is difficult, no guarantees are made as to the quality of a cursor image which isn't a supported size. It is therefore recommended that this method be called and an appropriate image used so no image conversion is made.

Parameters:
desiredWidth - the preferred cursor width the component would like to use.
desiredHeight - the preferred cursor height the component would like to use.
Returns:
the closest matching supported cursor size, or a dimension of 0,0 if the Toolkit implementation doesn't support custom cursors.
Since:
JDK1.2

getMaximumCursorColors

public int getMaximumCursorColors()
Returns the maximum number of colors the Toolkit supports in a custom cursor palette.

Note: if an image is used which has more colors in its palette than the supported maximum, the Toolkit implementation will attempt to flatten the palette to the maximum. Since converting low-resolution images is difficult, no guarantees are made as to the quality of a cursor image which has more colors than the system supports. It is therefore recommended that this method be called and an appropriate image used so no image conversion is made.

Returns:
the maximum number of colors, or zero if custom cursors are not supported by this Toolkit implementation.
Since:
JDK1.2

getProperty

public static String getProperty(String key,
                                 String defaultValue)
Gets a property with the specified key and default. This method returns defaultValue if the property is not found.

getSystemEventQueue

public final EventQueue getSystemEventQueue()
Get the application's or applet's EventQueue instance. Depending on the Toolkit implementation, different EventQueues may be returned for different applets. Applets should therefore not assume that the EventQueue instance returned by this method will be shared by other applets or the system.

First, if there is a security manager, its checkAwtEventQueueAccess method is called. If the default implementation of checkAwtEventQueueAccess is used (that is, that method is not overriden), then this results in a call to the security manager's checkPermission method with an AWTPermission("accessEventQueue") permission.

Returns:
the EventQueue object.
Throws:
SecurityException - if a security manager exists and its SecurityManager.checkAwtEventQueueAccess() method denies access to the EventQueue.
See Also:
AWTPermission

getSystemEventQueueImpl

protected abstract EventQueue getSystemEventQueueImpl()

createDragSourceContextPeer

public abstract java.awt.dnd.peer.DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge)
                                                                             throws InvalidDnDOperationException
create the peer for a DragSourceContext

createDragGestureRecognizer

public DragGestureRecognizer createDragGestureRecognizer(Class abstractRecognizerClass,
                                                         DragSource ds,
                                                         Component c,
                                                         int srcActions,
                                                         DragGestureListener dgl)
create a concrete, platform dependent, subclass of the abstract DragGestureRecognizer class requested, and associate it with the DragSource, Component and DragGestureListener specified subclasses should override this to provide their own implementation
Parameters:
abstractRecognizerClass - The abstract class of the required recognizer
ds - The DragSource
c - The Component target for the DragGestureRecognizer
srcActions - The actions permitted for the gesture
dgl - The DragGestureListener

getDesktopProperty

public final Object getDesktopProperty(String propertyName)
obtain a value for the specified desktop property. A desktop property is a uniquely named value for a resource that is Toolkit global in nature. Usually it also is an abstract representation for an underlying platform dependent desktop setting.

setDesktopProperty

protected final void setDesktopProperty(String name,
                                        Object newValue)
set the named desktop property to the specified value and fire a property change event to notify any listeners that the value has changed

lazilyLoadDesktopProperty

protected Object lazilyLoadDesktopProperty(String name)
an opportunity to lazily evaluate desktop property values.

initializeDesktopProperties

protected void initializeDesktopProperties()
initializeDesktopProperties

addPropertyChangeListener

public void addPropertyChangeListener(String name,
                                      PropertyChangeListener pcl)
add the specified property change listener for the named desktop property If pcl is null, no exception is thrown and no action is performed.
Parameters:
name - The name of the property to listen for
pcl - The property change listener

removePropertyChangeListener

public void removePropertyChangeListener(String name,
                                         PropertyChangeListener pcl)
remove the specified property change listener for the named desktop property If pcl is null, no exception is thrown and no action is performed.

addAWTEventListener

public void addAWTEventListener(AWTEventListener listener,
                                long eventMask)
Adds an AWTEventListener to receive all AWTEvents dispatched system-wide that conform to the given eventMask.

First, if there is a security manager, its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.

eventMask is a bitmask of event types to receive. It is constructed by bitwise OR-ing together the event masks defined in AWTEvent.

Note: event listener use is not recommended for normal application use, but are intended solely to support special purpose facilities including support for accessibility, event record/playback, and diagnostic tracing. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the event listener.
eventMask - the bitmask of event types to receive
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
Since:
JDK1.2
See Also:
AWTEventListener, java.awt.Toolkit#addEventListener, AWTEvent, SecurityManager.checkPermission(java.security.Permission), AWTPermission

removeAWTEventListener

public void removeAWTEventListener(AWTEventListener listener)
Removes an AWTEventListener from receiving dispatched AWTEvents.

First, if there is a security manager, its checkPermission method is called with an AWTPermission("listenToAllAWTEvents") permission. This may result in a SecurityException.

Note: event listener use is not recommended for normal application use, but are intended solely to support special purpose facilities including support for accessibility, event record/playback, and diagnostic tracing. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the event listener.
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
Since:
JDK1.2
See Also:
AWTEventListener, java.awt.Toolkit#addEventListener, AWTEvent, SecurityManager.checkPermission(java.security.Permission), AWTPermission

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.