java.lang.Object | +--java.awt.Toolkit
Unsafe: 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.
private static boolean
loaded
private static ResourceBundle
resources
Toolkit()
void
addAWTEventListener(AWTEventListener listener,
long eventMask)
eventMask.
void
addPropertyChangeListener(String name,
java.beans.PropertyChangeListener pcl)
abstract int
checkImage(Image image,
int width,
int height,
java.awt.image.ImageObserver observer)
protected abstract java.awt.peer.ButtonPeer
createButton(Button target)
Button using
the specified peer interface.
protected abstract java.awt.peer.CanvasPeer
createCanvas(Canvas target)
Canvas using
the specified peer interface.
protected abstract java.awt.peer.CheckboxPeer
createCheckbox(Checkbox target)
Checkbox using
the specified peer interface.
protected abstract java.awt.peer.CheckboxMenuItemPeer
createCheckboxMenuItem(CheckboxMenuItem target)
CheckboxMenuItem using
the specified peer interface.
protected abstract java.awt.peer.ChoicePeer
createChoice(Choice target)
Choice using
the specified peer interface.
protected java.awt.peer.LightweightPeer
createComponent(Component target)
Cursor
createCustomCursor(Image cursor,
Point hotSpot,
String name)
protected abstract java.awt.peer.DialogPeer
createDialog(Dialog target)
Dialog using
the specified peer interface.
DragGestureRecognizer
createDragGestureRecognizer(Class abstractRecognizerClass,
DragSource ds,
Component c,
int srcActions,
DragGestureListener dgl)
abstract java.awt.dnd.peer.DragSourceContextPeer
createDragSourceContextPeer(DragGestureEvent dge)
protected abstract java.awt.peer.FileDialogPeer
createFileDialog(FileDialog target)
FileDialog using
the specified peer interface.
protected abstract java.awt.peer.FramePeer
createFrame(Frame target)
Frame using
the specified peer interface.
Image
createImage(byte[] imagedata)
abstract Image
createImage(byte[] imagedata,
int imageoffset,
int imagelength)
abstract Image
createImage(java.awt.image.ImageProducer producer)
abstract Image
createImage(String filename)
abstract Image
createImage(URL url)
protected abstract java.awt.peer.LabelPeer
createLabel(Label target)
Label using
the specified peer interface.
protected abstract java.awt.peer.ListPeer
createList(List target)
List using
the specified peer interface.
protected abstract java.awt.peer.MenuPeer
createMenu(Menu target)
Menu using
the specified peer interface.
protected abstract java.awt.peer.MenuBarPeer
createMenuBar(MenuBar target)
MenuBar using
the specified peer interface.
protected abstract java.awt.peer.MenuItemPeer
createMenuItem(MenuItem target)
MenuItem using
the specified peer interface.
protected abstract java.awt.peer.PanelPeer
createPanel(Panel target)
Panel using
the specified peer interface.
protected abstract java.awt.peer.PopupMenuPeer
createPopupMenu(PopupMenu target)
PopupMenu using
the specified peer interface.
protected abstract java.awt.peer.ScrollbarPeer
createScrollbar(Scrollbar target)
Scrollbar using
the specified peer interface.
protected abstract java.awt.peer.ScrollPanePeer
createScrollPane(ScrollPane target)
ScrollPane using
the specified peer interface.
protected abstract java.awt.peer.TextAreaPeer
createTextArea(TextArea target)
TextArea using
the specified peer interface.
protected abstract java.awt.peer.TextFieldPeer
createTextField(TextField target)
TextField using
the specified peer interface.
protected abstract java.awt.peer.WindowPeer
createWindow(Window target)
Window using
the specified peer interface.
AWTEventListener[]
getAWTEventListeners()
AWTEventListeners
registered on this toolkit.
AWTEventListener[]
getAWTEventListeners(long eventMask)
AWTEventListeners
registered on this toolkit which listen to all of the event
types indicates in the eventMask argument.
Dimension
getBestCursorSize(int preferredWidth,
int preferredHeight)
abstract java.awt.image.ColorModel
getColorModel()
Object
getDesktopProperty(String propertyName)
abstract String[]
getFontList()
java.awt.GraphicsEnvironment#getAvailableFontFamilyNames()
abstract FontMetrics
getFontMetrics(Font font)
Font
method getLineMetrics.
protected abstract java.awt.peer.FontPeer
getFontPeer(String name,
int style)
abstract Image
getImage(String filename)
abstract Image
getImage(URL url)
boolean
getLockingKeyState(int keyCode)
int
getMaximumCursorColors()
int
getMenuShortcutKeyMask()
protected static Container
getNativeContainer(Component c)
PrintJob
getPrintJob(Frame frame,
String jobtitle,
JobAttributes jobAttributes,
PageAttributes pageAttributes)
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)
PrintJob object which is the result of initiating
a print operation on the toolkit's platform.
static String
getProperty(String key,
String defaultValue)
java.beans.PropertyChangeListener[]
getPropertyChangeListeners()
java.beans.PropertyChangeListener[]
getPropertyChangeListeners(String propertyName)
PropertyChangeListeners
associated with the named property.
abstract Clipboard
getSystemClipboard()
Clipboard
getSystemSelection()
Clipboard object.
boolean
isDynamicLayoutActive()
protected boolean
isDynamicLayoutSet()
boolean
isFrameStateSupported(int state)
Frames.
protected Object
lazilyLoadDesktopProperty(String name)
private static void
loadAssistiveTechnologies()
protected void
loadSystemColors(int[] systemColors)
abstract Map
mapInputMethodHighlight(java.awt.im.InputMethodHighlight highlight)
abstract boolean
prepareImage(Image image,
int width,
int height,
java.awt.image.ImageObserver observer)
void
removeAWTEventListener(AWTEventListener listener)
void
removePropertyChangeListener(String name,
java.beans.PropertyChangeListener pcl)
protected void
setDesktopProperty(String name,
Object newValue)
void
setDynamicLayout(boolean dynamic)
void
setLockingKeyState(int keyCode,
boolean on)
private static java.awt.peer.LightweightPeer lightweightMarker
private static Toolkit toolkit
private static ResourceBundle resources
private static boolean loaded
protected final Map desktopProperties
protected final java.beans.PropertyChangeSupport desktopPropsSupport
private static final sun.awt.DebugHelper dbg
private static final int LONG_BITS
private int[] calls
private AWTEventListener eventListener
private WeakHashMap listener2SelectiveListener
private AWTPermission listenToAllAWTEventsPermission
public Toolkit()
protected abstract java.awt.peer.ButtonPeer createButton(Button target) throws HeadlessException
Button using
the specified peer interface.
target - the button to be implemented.
Button.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Button,
java.awt.peer.ButtonPeerprotected abstract java.awt.peer.TextFieldPeer createTextField(TextField target) throws HeadlessException
TextField using
the specified peer interface.
target - the text field to be implemented.
TextField.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.TextField,
java.awt.peer.TextFieldPeerprotected abstract java.awt.peer.LabelPeer createLabel(Label target) throws HeadlessException
Label using
the specified peer interface.
target - the label to be implemented.
Label.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Label,
java.awt.peer.LabelPeerprotected abstract java.awt.peer.ListPeer createList(List target) throws HeadlessException
List using
the specified peer interface.
target - the list to be implemented.
List.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.List,
java.awt.peer.ListPeerprotected abstract java.awt.peer.CheckboxPeer createCheckbox(Checkbox target) throws HeadlessException
Checkbox using
the specified peer interface.
target - the check box to be implemented.
Checkbox.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Checkbox,
java.awt.peer.CheckboxPeerprotected abstract java.awt.peer.ScrollbarPeer createScrollbar(Scrollbar target) throws HeadlessException
Scrollbar using
the specified peer interface.
target - the scroll bar to be implemented.
Scrollbar.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Scrollbar,
java.awt.peer.ScrollbarPeerprotected abstract java.awt.peer.ScrollPanePeer createScrollPane(ScrollPane target) throws HeadlessException
ScrollPane using
the specified peer interface.
target - the scroll pane to be implemented.
ScrollPane.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.ScrollPane,
java.awt.peer.ScrollPanePeerprotected abstract java.awt.peer.TextAreaPeer createTextArea(TextArea target) throws HeadlessException
TextArea using
the specified peer interface.
target - the text area to be implemented.
TextArea.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.TextArea,
java.awt.peer.TextAreaPeerprotected abstract java.awt.peer.ChoicePeer createChoice(Choice target) throws HeadlessException
Choice using
the specified peer interface.
target - the choice to be implemented.
Choice.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Choice,
java.awt.peer.ChoicePeerprotected abstract java.awt.peer.FramePeer createFrame(Frame target) throws HeadlessException
Frame using
the specified peer interface.
target - the frame to be implemented.
Frame.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Frame,
java.awt.peer.FramePeerprotected abstract java.awt.peer.CanvasPeer createCanvas(Canvas target)
Canvas using
the specified peer interface.
target - the canvas to be implemented.
Canvas.java.awt.Canvas,
java.awt.peer.CanvasPeerprotected abstract java.awt.peer.PanelPeer createPanel(Panel target)
Panel using
the specified peer interface.
target - the panel to be implemented.
Panel.java.awt.Panel,
java.awt.peer.PanelPeerprotected abstract java.awt.peer.WindowPeer createWindow(Window target) throws HeadlessException
Window using
the specified peer interface.
target - the window to be implemented.
Window.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Window,
java.awt.peer.WindowPeerprotected abstract java.awt.peer.DialogPeer createDialog(Dialog target) throws HeadlessException
Dialog using
the specified peer interface.
target - the dialog to be implemented.
Dialog.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Dialog,
java.awt.peer.DialogPeerprotected abstract java.awt.peer.MenuBarPeer createMenuBar(MenuBar target) throws HeadlessException
MenuBar using
the specified peer interface.
target - the menu bar to be implemented.
MenuBar.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.MenuBar,
java.awt.peer.MenuBarPeerprotected abstract java.awt.peer.MenuPeer createMenu(Menu target) throws HeadlessException
Menu using
the specified peer interface.
target - the menu to be implemented.
Menu.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.Menu,
java.awt.peer.MenuPeerprotected abstract java.awt.peer.PopupMenuPeer createPopupMenu(PopupMenu target) throws HeadlessException
PopupMenu using
the specified peer interface.
target - the popup menu to be implemented.
PopupMenu.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.PopupMenu,
java.awt.peer.PopupMenuPeerprotected abstract java.awt.peer.MenuItemPeer createMenuItem(MenuItem target) throws HeadlessException
MenuItem using
the specified peer interface.
target - the menu item to be implemented.
MenuItem.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.MenuItem,
java.awt.peer.MenuItemPeerprotected abstract java.awt.peer.FileDialogPeer createFileDialog(FileDialog target) throws HeadlessException
FileDialog using
the specified peer interface.
target - the file dialog to be implemented.
FileDialog.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.FileDialog,
java.awt.peer.FileDialogPeerprotected abstract java.awt.peer.CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) throws HeadlessException
CheckboxMenuItem using
the specified peer interface.
target - the checkbox menu item to be implemented.
CheckboxMenuItem.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.CheckboxMenuItem,
java.awt.peer.CheckboxMenuItemPeerprotected java.awt.peer.LightweightPeer createComponent(Component target)
target - The Component to be created.protected abstract java.awt.peer.FontPeer getFontPeer(String name, int style)
Font using
the specified peer interface.
name - the font to be implementedstyle - the style of the font, such as PLAIN,
BOLD, ITALIC, or a combination
Fontjava.awt.Font,
java.awt.peer.FontPeer,
java.awt.GraphicsEnvironment#getAllFontsprotected void loadSystemColors(int[] systemColors) throws HeadlessException
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic void setDynamicLayout(boolean dynamic) throws HeadlessException
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.
HeadlessExceptionisDynamicLayoutSet(),
isDynamicLayoutActive(),
getDesktopProperty(String propertyName),
java.awt.GraphicsEnvironment#isHeadlessprotected boolean isDynamicLayoutSet() throws HeadlessException
HeadlessExceptionsetDynamicLayout(boolean dynamic),
isDynamicLayoutActive(),
getDesktopProperty(String propertyName),
java.awt.GraphicsEnvironment#isHeadlesspublic boolean isDynamicLayoutActive() throws HeadlessException
HeadlessExceptionsetDynamicLayout(boolean dynamic),
isDynamicLayoutSet(),
getDesktopProperty(String propertyName),
java.awt.GraphicsEnvironment#isHeadlesspublic abstract Dimension getScreenSize() throws HeadlessException
GraphicsConfiguration and
GraphicsDevice.
HeadlessExceptionjava.awt.GraphicsConfiguration#getBounds,
java.awt.GraphicsDevice#getDisplayMode,
java.awt.GraphicsEnvironment#isHeadlesspublic abstract int getScreenResolution() throws HeadlessException
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic abstract java.awt.image.ColorModel getColorModel() throws HeadlessException
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.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.image.ColorModel,
java.awt.Component#getColorModelpublic abstract String[] getFontList()
java.awt.GraphicsEnvironment#getAvailableFontFamilyNames()
For 1.1, the following font names are deprecated (the replacement name follows):
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.
java.awt.GraphicsEnvironment#getAvailableFontFamilyNames()public abstract FontMetrics getFontMetrics(Font font)
Font
method getLineMetrics.
font - a font
java.awt.font.LineMetrics,
java.awt.Font#getLineMetrics,
java.awt.GraphicsEnvironment#getScreenDevicespublic abstract void sync()
This method ensures that the display is up-to-date. It is useful for animation.
private static void loadAssistiveTechnologies()
The assumption is made that assistive technology classes are supplied
as part of INSTALLED (as opposed to: BUNDLED) extensions or specified
on the class path
(and therefore can be loaded using the class loader returned by
a call to ClassLoader.getSystemClassLoader, whose
delegation parent is the extension class loader for installed
extensions).
public static Toolkit getDefaultToolkit()
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.
public abstract Image getImage(String filename)
filename - the name of a file containing pixel data
in a recognized file format.
createImage(java.lang.String)public abstract Image getImage(URL url)
url - the URL to use in fetching the pixel data.
createImage(java.net.URL)public abstract Image createImage(String filename)
filename - the name of a file containing pixel data
in a recognized file format.
getImage(java.lang.String)public abstract Image createImage(URL url)
url - the URL to use in fetching the pixel data.
getImage(java.net.URL)public abstract boolean prepareImage(Image image, int width, int height, java.awt.image.ImageObserver observer)
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.
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.
true if the image has already been
fully prepared; false otherwise.java.awt.Component#prepareImage(java.awt.Image,
java.awt.image.ImageObserver),
java.awt.Component#prepareImage(java.awt.Image,
int, int, java.awt.image.ImageObserver),
java.awt.image.ImageObserverpublic abstract int checkImage(Image image, int width, int height, java.awt.image.ImageObserver observer)
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.
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.
ImageObserver flags for the
image data that is currently available.java.awt.Toolkit#prepareImage(java.awt.Image,
int, int, java.awt.image.ImageObserver),
java.awt.Component#checkImage(java.awt.Image,
java.awt.image.ImageObserver),
java.awt.Component#checkImage(java.awt.Image,
int, int, java.awt.image.ImageObserver),
java.awt.image.ImageObserverpublic abstract Image createImage(java.awt.image.ImageProducer producer)
producer - the image producer to be used.
java.awt.Image,
java.awt.image.ImageProducer,
java.awt.Component#createImage(java.awt.image.ImageProducer)public Image createImage(byte[] imagedata)
The data must be in some image format, such as GIF or JPEG, that is supported by this toolkit.
imagedata - an array of bytes, representing
image data in a supported image format.
public abstract Image createImage(byte[] imagedata, int imageoffset, int imagelength)
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.
public abstract PrintJob getPrintJob(Frame frame, String jobtitle, Properties props)
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.
frame - the parent of the print dialog. May not be null.jobtitle - the title of the PrintJob. A null title is equivalent
to "".props - a Properties object containing zero or more properties.
Properties are not standardized and are not consistent across
implementations. Because of this, PrintJobs which require job
and page control should use the version of this function which
takes JobAttributes and PageAttributes objects. This object
may be updated to reflect the user's job choices on exit. May
be null.
PrintJob object, or null if the
user cancelled the print job.
NullPointerException - if frame is null. This exception is
always thrown when GraphicsEnvironment.isHeadless() returns
true.
SecurityException - if this thread is not allowed to initiate a
print job requestjava.awt.GraphicsEnvironment#isHeadless,
java.awt.PrintJob,
java.lang.RuntimePermissionpublic PrintJob getPrintJob(Frame frame, String jobtitle, JobAttributes jobAttributes, PageAttributes pageAttributes)
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.
frame - the parent of the print dialog. May be null if and only
if jobAttributes is not null and jobAttributes.getDialog()
returns JobAttributes.DialogType.NONE or
JobAttributes.DialogType.COMMON.jobtitle - the title of the PrintJob. A null title is equivalent
to "".jobAttributes - a set of job attributes which will control the
PrintJob. The attributes will be updated to reflect the user's
choices as outlined in the JobAttributes documentation. May be
null.pageAttributes - a set of page attributes which will control the
PrintJob. The attributes will be applied to every page in the
job. The attributes will be updated to reflect the user's
choices as outlined in the PageAttributes documentation. May be
null.
PrintJob object, or null if the
user cancelled the print job.
NullPointerException - if frame is null and either jobAttributes
is null or jobAttributes.getDialog() returns
JobAttributes.DialogType.NATIVE.
IllegalArgumentException - if pageAttributes specifies differing
cross feed and feed resolutions. This exception is always
thrown when GraphicsEnvironment.isHeadless() returns true.
SecurityException - if this thread is not allowed to initiate a
print job request, or if jobAttributes specifies print to file,
and this thread is not allowed to access the file systemjava.awt.PrintJob,
java.awt.GraphicsEnvironment#isHeadless,
java.lang.RuntimePermission,
java.awt.JobAttributes,
java.awt.PageAttributespublic abstract void beep()
public abstract Clipboard getSystemClipboard() throws HeadlessException
In addition to any and all formats specified in the flavormap.properties
file, or other file specified by the AWT.DnD.flavorMapFileURL
Toolkit property, text returned by the system Clipboard's
getTransferData() method is available in the following flavors:
java.awt.datatransfer.StringSelection, if the
requested flavor is DataFlavor.plainTextFlavor, or an
equivalent flavor, a Reader is returned. Note: The behavior of
the system Clipboard's getTransferData() method for
DataFlavor.plainTextFlavor, and equivalent DataFlavors, is
inconsistent with the definition of DataFlavor.plainTextFlavor
. Because of this, support for
DataFlavor.plainTextFlavor, and equivalent flavors, is
deprecated.
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.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.datatransfer.Clipboard,
java.awt.datatransfer.StringSelection,
java.awt.datatransfer.DataFlavor.stringFlavor,
java.awt.datatransfer.DataFlavor.plainTextFlavor,
java.io.Reader,
java.awt.AWTPermissionpublic Clipboard getSystemSelection() throws HeadlessException
Clipboard object. This allows an application to read and
modify the current, system-wide selection.
An application is responsible for updating the system selection whenever
the user selects text, using either the mouse or the keyboard.
Typically, this is implemented by installing a
FocusListener on all Components which support
text selection, and, between FOCUS_GAINED and
FOCUS_LOST events delivered to that Component,
updating the system selection Clipboard when the selection
changes inside the Component. Properly updating the system
selection ensures that a Java application will interact correctly with
native applications and other Java applications running simultaneously
on the system. Note that java.awt.TextComponent and
javax.swing.text.JTextComponent already adhere to this
policy. When using these classes, and their subclasses, developers need
not write any additional code.
Some platforms do not support a system selection Clipboard.
On those platforms, this method will return null. In such a
case, an application is absolved from its responsibility to update the
system selection Clipboard as described above.
Each actual implementation of this method should first check if there
is a SecurityManager installed. If there is, the method
should call the SecurityManager's
checkSystemClipboardAccess method to ensure that client
code has access the system selection. If the default implementation of
checkSystemClipboardAccess is used (that is, if the method
is not overridden), then this results in a call to the
SecurityManager's checkPermission method with
an AWTPermission("accessClipboard") permission.
Clipboard, or
null if the native platform does not support a
system selection Clipboard
HeadlessExceptionjava.awt.datatransfer.Clipboard,
java.awt.event.FocusListener,
java.awt.event.FocusEvent#FOCUS_GAINED,
java.awt.event.FocusEvent#FOCUS_LOST,
TextComponent,
javax.swing.text.JTextComponent,
AWTPermission,
GraphicsEnvironment.isHeadless()public int getMenuShortcutKeyMask() throws HeadlessException
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.
Event class
that is used for menu shortcuts on this toolkit.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless,
java.awt.MenuBar,
java.awt.MenuShortcutpublic boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException
VK_CAPS_LOCK,
VK_NUM_LOCK,
VK_SCROLL_LOCK, and
VK_KANA_LOCK.
UnsupportedOperationExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic void setLockingKeyState(int keyCode, boolean on) throws UnsupportedOperationException
VK_CAPS_LOCK,
VK_NUM_LOCK,
VK_SCROLL_LOCK, and
VK_KANA_LOCK.
Depending on the platform, setting the state of a locking key may involve event processing and therefore may not be immediately observable through getLockingKeyState.
UnsupportedOperationExceptionjava.awt.GraphicsEnvironment#isHeadlessprotected static Container getNativeContainer(Component c)
public Cursor createCustomCursor(Image cursor, Point hotSpot, String name) throws IndexOutOfBoundsException, HeadlessException
Note that multi-frame images are invalid and may cause this method to hang.
hotSpot - the X and Y of the large cursor's hot spot; the
hotSpot values must be less than the Dimension returned by
getBestCursorSizename - a localized description of the cursor, for Java Accessibility use
IndexOutOfBoundsException
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic Dimension getBestCursorSize(int preferredWidth, int preferredHeight) throws HeadlessException
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.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic int getMaximumCursorColors() throws HeadlessException
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.
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic boolean isFrameStateSupported(int state) throws HeadlessException
Frames. This method tells whether the UI
concept of, say, maximization or iconification is
supported. It will always return false for "compound" states
like Frame.ICONIFIED|Frame.MAXIMIZED_VERT.
In other words, the rule of thumb is that only queries with a
single frame state constant as an argument are meaningful.
state - one of named frame state constants.
true is this frame state is supported by
this Toolkit implementation, false otherwise.
HeadlessExceptionjava.awt.Frame#setExtendedStateprivate static void initIDs()
static void loadLibraries()
public static String getProperty(String key, String defaultValue)
public final EventQueue getSystemEventQueue()
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.
EventQueue object.
SecurityException - if a security manager exists and its java.lang.SecurityManager#checkAwtEventQueueAccess method denies
access to the EventQueue.java.awt.AWTPermissionprotected abstract EventQueue getSystemEventQueueImpl()
static EventQueue getEventQueue()
public abstract java.awt.dnd.peer.DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException
InvalidDnDOperationExceptionjava.awt.GraphicsEnvironment#isHeadlesspublic DragGestureRecognizer createDragGestureRecognizer(Class abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl)
abstractRecognizerClass - The abstract class of the required recognizerds - The DragSourcec - The Component target for the DragGestureRecognizersrcActions - The actions permitted for the gesturedgl - The DragGestureListenerjava.awt.GraphicsEnvironment#isHeadlesspublic final Object getDesktopProperty(String propertyName)
protected final void setDesktopProperty(String name, Object newValue)
protected Object lazilyLoadDesktopProperty(String name)
protected void initializeDesktopProperties()
public void addPropertyChangeListener(String name, java.beans.PropertyChangeListener pcl)
name - The name of the property to listen forpcl - The property change listenerpublic void removePropertyChangeListener(String name, java.beans.PropertyChangeListener pcl)
name - The name of the property to removepcl - The property change listenerpublic java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListeners
or an empty array if no property change
listeners are currently registeredpublic java.beans.PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
PropertyChangeListeners
associated with the named property.
propertyName - the named property
PropertyChangeListeners associated with
the named property or an empty array if no such listeners have
been addedprivate static AWTEventListener deProxyAWTEventListener(AWTEventListener l)
public void addAWTEventListener(AWTEventListener listener, long eventMask)
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.
listener - the event listener.eventMask - the bitmask of event types to receive
SecurityException - if a security manager exists and its
checkPermission method doesn't allow the operation.removeAWTEventListener(java.awt.event.AWTEventListener),
getAWTEventListeners(),
SecurityManager.checkPermission(java.security.Permission),
java.awt.AWTEvent,
java.awt.AWTPermission,
java.awt.event.AWTEventListener,
java.awt.event.AWTEventListenerProxypublic void removeAWTEventListener(AWTEventListener listener)
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.
listener - the event listener.
SecurityException - if a security manager exists and its
checkPermission method doesn't allow the operation.addAWTEventListener(java.awt.event.AWTEventListener, long),
getAWTEventListeners(),
SecurityManager.checkPermission(java.security.Permission),
java.awt.AWTEvent,
java.awt.AWTPermission,
java.awt.event.AWTEventListener,
java.awt.event.AWTEventListenerProxystatic boolean enabledOnToolkit(long eventMask)
int countAWTEventListeners(long eventMask)
public AWTEventListener[] getAWTEventListeners()
AWTEventListeners
registered on this toolkit. Listeners can be returned
within AWTEventListenerProxy objects, which also contain
the event mask for the given listener.
Note that listener objects
added multiple times appear only once in the returned array.
AWTEventListeners or an empty
array if no listeners are currently registered
SecurityException - if a security manager exists and its
checkPermission method doesn't allow the operation.addAWTEventListener(java.awt.event.AWTEventListener, long),
removeAWTEventListener(java.awt.event.AWTEventListener),
SecurityManager.checkPermission(java.security.Permission),
java.awt.AWTEvent,
java.awt.AWTPermission,
java.awt.event.AWTEventListener,
java.awt.event.AWTEventListenerProxypublic AWTEventListener[] getAWTEventListeners(long eventMask)
AWTEventListeners
registered on this toolkit which listen to all of the event
types indicates in the eventMask argument.
Listeners can be returned
within AWTEventListenerProxy objects, which also contain
the event mask for the given listener.
Note that listener objects
added multiple times appear only once in the returned array.
AWTEventListeners registered
on this toolkit for the specified
event types, or an empty array if no such listeners
are currently registered
SecurityException - if a security manager exists and its
checkPermission method doesn't allow the operation.addAWTEventListener(java.awt.event.AWTEventListener, long),
removeAWTEventListener(java.awt.event.AWTEventListener),
SecurityManager.checkPermission(java.security.Permission),
java.awt.AWTEvent,
java.awt.AWTPermission,
java.awt.event.AWTEventListener,
java.awt.event.AWTEventListenerProxyvoid notifyAWTEventListeners(AWTEvent theEvent)
public abstract Map mapInputMethodHighlight(java.awt.im.InputMethodHighlight highlight) throws HeadlessException
highlight - input method highlight
null
HeadlessExceptionjava.awt.GraphicsEnvironment#isHeadless