Toolkit.java revision 1714
1892N/A * Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. 1892N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1892N/A * This code is free software; you can redistribute it and/or modify it 1892N/A * under the terms of the GNU General Public License version 2 only, as 1892N/A * published by the Free Software Foundation. Sun designates this 1892N/A * particular file as subject to the "Classpath" exception as provided 1892N/A * by Sun in the LICENSE file that accompanied this code. 1892N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1892N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1892N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1892N/A * version 2 for more details (a copy is included in the LICENSE file that 1892N/A * You should have received a copy of the GNU General Public License version 1892N/A * 2 along with this work; if not, write to the Free Software Foundation, 1892N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1892N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1892N/A * CA 95054 USA or visit www.sun.com if you need additional information or 1892N/A * This class is the abstract superclass of all actual 1892N/A * implementations of the Abstract Window Toolkit. Subclasses of 1892N/A * the <code>Toolkit</code> class are used to bind the various components 1892N/A * to particular native toolkit implementations. 1892N/A * Many GUI events may be delivered to user 1892N/A * asynchronously, if the opposite is not specified explicitly. 1892N/A * many GUI operations may be performed asynchronously. 1892N/A * This fact means that if the state of a component is set, and then 1892N/A * the state immediately queried, the returned value may not yet 1892N/A * reflect the requested change. This behavior includes, but is not 1892N/A * <li>Scrolling to a specified position. 1892N/A * <br>For example, calling <code>ScrollPane.setScrollPosition</code> 1892N/A * and then <code>getScrollPosition</code> may return an incorrect 1892N/A * value if the original request has not yet been processed. 1892N/A * <li>Moving the focus from one component to another. 1892N/A * <br>For more information, see 1892N/A * Focus Transfers</a>, a section in 1892N/A * <li>Making a top-level container visible. 1892N/A * <br>Calling <code>setVisible(true)</code> on a <code>Window</code>, 1892N/A * <code>Frame</code> or <code>Dialog</code> may occur 1892N/A * <li>Setting the size or location of a top-level container. 1892N/A * <br>Calls to <code>setSize</code>, <code>setBounds</code> or 1892N/A * <code>setLocation</code> on a <code>Window</code>, 1892N/A * <code>Frame</code> or <code>Dialog</code> are forwarded 1892N/A * to the underlying window management system and may be 1892N/A * ignored or modified. See {@link java.awt.Window} for 1892N/A * Most applications should not call any of the methods in this 1892N/A * class directly. The methods defined by <code>Toolkit</code> are 1892N/A * the "glue" that joins the platform-independent classes in the 1892N/A * <code>java.awt</code> package with their counterparts in 1892N/A * <code>java.awt.peer</code>. Some methods defined by 1892N/A * <code>Toolkit</code> query the native operating system directly. 1892N/A * Creates this toolkit's implementation of the <code>Desktop</code> 1892N/A * using the specified peer interface. 1892N/A * @param target the desktop to be implemented 1892N/A * @return this toolkit's implementation of the <code>Desktop</code> 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.DesktopPeer 1892N/A * Creates this toolkit's implementation of <code>Button</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the button to be implemented. 1892N/A * @return this toolkit's implementation of <code>Button</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.ButtonPeer 1892N/A * Creates this toolkit's implementation of <code>TextField</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the text field to be implemented. 1892N/A * @return this toolkit's implementation of <code>TextField</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.TextFieldPeer 1892N/A * Creates this toolkit's implementation of <code>Label</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the label to be implemented. 1892N/A * @return this toolkit's implementation of <code>Label</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.LabelPeer 1892N/A * Creates this toolkit's implementation of <code>List</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the list to be implemented. 1892N/A * @return this toolkit's implementation of <code>List</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.ListPeer 1892N/A * Creates this toolkit's implementation of <code>Checkbox</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the check box to be implemented. 1892N/A * @return this toolkit's implementation of <code>Checkbox</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.CheckboxPeer 1892N/A * Creates this toolkit's implementation of <code>Scrollbar</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the scroll bar to be implemented. 1892N/A * @return this toolkit's implementation of <code>Scrollbar</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.ScrollbarPeer 1892N/A * Creates this toolkit's implementation of <code>ScrollPane</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the scroll pane to be implemented. 1892N/A * @return this toolkit's implementation of <code>ScrollPane</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.ScrollPanePeer 1892N/A * Creates this toolkit's implementation of <code>TextArea</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the text area to be implemented. 1892N/A * @return this toolkit's implementation of <code>TextArea</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.TextAreaPeer 1892N/A * Creates this toolkit's implementation of <code>Choice</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the choice to be implemented. 1892N/A * @return this toolkit's implementation of <code>Choice</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.ChoicePeer 1892N/A * Creates this toolkit's implementation of <code>Frame</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the frame to be implemented. 1892N/A * @return this toolkit's implementation of <code>Frame</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.FramePeer 1892N/A * Creates this toolkit's implementation of <code>Canvas</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the canvas to be implemented. 1892N/A * @return this toolkit's implementation of <code>Canvas</code>. 1892N/A * @see java.awt.peer.CanvasPeer 1892N/A * Creates this toolkit's implementation of <code>Panel</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the panel to be implemented. 1892N/A * @return this toolkit's implementation of <code>Panel</code>. 1892N/A * @see java.awt.peer.PanelPeer 1892N/A * Creates this toolkit's implementation of <code>Window</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the window to be implemented. 1892N/A * @return this toolkit's implementation of <code>Window</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.WindowPeer 1892N/A * Creates this toolkit's implementation of <code>Dialog</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the dialog to be implemented. 1892N/A * @return this toolkit's implementation of <code>Dialog</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.DialogPeer 1892N/A * Creates this toolkit's implementation of <code>MenuBar</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the menu bar to be implemented. 1892N/A * @return this toolkit's implementation of <code>MenuBar</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.MenuBarPeer 1892N/A * Creates this toolkit's implementation of <code>Menu</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the menu to be implemented. 1892N/A * @return this toolkit's implementation of <code>Menu</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.MenuPeer 1892N/A * Creates this toolkit's implementation of <code>PopupMenu</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the popup menu to be implemented. 1892N/A * @return this toolkit's implementation of <code>PopupMenu</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.PopupMenuPeer 1892N/A * Creates this toolkit's implementation of <code>MenuItem</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the menu item to be implemented. 1892N/A * @return this toolkit's implementation of <code>MenuItem</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.MenuItemPeer 1892N/A * Creates this toolkit's implementation of <code>FileDialog</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the file dialog to be implemented. 1892N/A * @return this toolkit's implementation of <code>FileDialog</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.peer.FileDialogPeer 1892N/A * Creates this toolkit's implementation of <code>CheckboxMenuItem</code> using 1892N/A * the specified peer interface. 1892N/A * @param target the checkbox menu item to be implemented. 1892N/A * @return this toolkit's implementation of <code>CheckboxMenuItem</code>. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.CheckboxMenuItem 1892N/A * @see java.awt.peer.CheckboxMenuItemPeer 1892N/A * Obtains this toolkit's implementation of helper class for 1892N/A * <code>MouseInfo</code> operations. 1892N/A * @return this toolkit's implementation of helper for <code>MouseInfo</code> 1892N/A * @throws UnsupportedOperationException if this operation is not implemented 1892N/A * @see java.awt.peer.MouseInfoPeer 1892N/A * Creates a peer for a component or container. This peer is windowless 1892N/A * and allows the Component and Container classes to be extended directly 1892N/A * to create windowless components that are defined entirely in java. 1892N/A * @param target The Component to be created. 1892N/A * Creates this toolkit's implementation of <code>Font</code> using 1892N/A * the specified peer interface. 1892N/A * @param name the font to be implemented 1892N/A * @param style the style of the font, such as <code>PLAIN</code>, 1892N/A * <code>BOLD</code>, <code>ITALIC</code>, or a combination 1892N/A * @return this toolkit's implementation of <code>Font</code> 1892N/A * @see java.awt.peer.FontPeer 1892N/A * @see java.awt.GraphicsEnvironment#getAllFonts 1892N/A * @deprecated see java.awt.GraphicsEnvironment#getAllFonts 1892N/A // The following method is called by the private method 1892N/A // <code>updateSystemColors</code> in <code>SystemColor</code>. 1892N/A * Fills in the integer array that is supplied as an argument 1892N/A * with the current system color values. 1892N/A * @param systemColors an integer array. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Controls whether the layout of Containers is validated dynamically 1892N/A * during resizing, or statically, after resizing is complete. 1892N/A * Use {@code isDynamicLayoutActive()} to detect if this feature enabled 1892N/A * in this program and is supported by this operating system 1892N/A * Note that this feature is supported not on all platforms, and 1892N/A * conversely, that this feature cannot be turned off on some platforms. 1892N/A * On these platforms where dynamic layout during resizing is not supported 1892N/A * (or is always supported), setting this property has no effect. 1892N/A * Note that this feature can be set or unset as a property of the 1892N/A * operating system or window manager on some platforms. On such 1892N/A * platforms, the dynamic resize property must be set at the operating 1892N/A * system or window manager level before this method can take effect. 1892N/A * This method does not change support or settings of the underlying 1892N/A * queried using getDesktopProperty("awt.dynamicLayoutSupported") method. 1892N/A * @param dynamic If true, Containers should re-layout their 1892N/A * components as the Container is being resized. If false, 1892N/A * the layout will be validated after resizing is completed. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see #isDynamicLayoutSet() 1892N/A * @see #isDynamicLayoutActive() 1892N/A * @see #getDesktopProperty(String propertyName) 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Returns whether the layout of Containers is validated dynamically 1892N/A * during resizing, or statically, after resizing is complete. 1892N/A * Note: this method returns the value that was set programmatically; 1892N/A * it does not reflect support at the level of the operating system 1892N/A * or window manager for dynamic layout on resizing, or the current 1892N/A * operating system or window manager settings. The OS/WM support can 1892N/A * be queried using getDesktopProperty("awt.dynamicLayoutSupported"). 1892N/A * @return true if validation of Containers is done dynamically, 1892N/A * false if validation is done after resizing is finished. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see #setDynamicLayout(boolean dynamic) 1892N/A * @see #isDynamicLayoutActive() 1892N/A * @see #getDesktopProperty(String propertyName) 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Returns whether dynamic layout of Containers on resize is 1892N/A * currently active (both set in program 1892N/A *( {@code isDynamicLayoutSet()} ) 1892N/A * by the underlying operating system and/or window manager). 1892N/A * If dynamic layout is currently inactive then Containers 1892N/A * re-layout their components when resizing is completed. As a result 1892N/A * the {@code Component.validate()} method will be invoked only 1892N/A * If dynamic layout is currently active then Containers 1892N/A * re-layout their components on every native resize event and 1892N/A * the {@code validate()} method will be invoked each time. 1892N/A * the getDesktopProperty("awt.dynamicLayoutSupported") method. 1892N/A * @return true if dynamic layout of Containers on resize is 1892N/A * currently active, false otherwise. 1892N/A * @exception HeadlessException if the GraphicsEnvironment.isHeadless() 1892N/A * @see #setDynamicLayout(boolean dynamic) 1892N/A * @see #isDynamicLayoutSet() 1892N/A * @see #getDesktopProperty(String propertyName) 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Gets the size of the screen. On systems with multiple displays, the 1892N/A * primary display is used. Multi-screen aware display dimensions are 1892N/A * available from <code>GraphicsConfiguration</code> and 1892N/A * <code>GraphicsDevice</code>. 1892N/A * @return the size of this toolkit's screen, in pixels. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsConfiguration#getBounds 1892N/A * @see java.awt.GraphicsDevice#getDisplayMode 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Returns the screen resolution in dots-per-inch. 1892N/A * @return this toolkit's screen resolution, in dots-per-inch. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Gets the insets of the screen. 1892N/A * @param gc a <code>GraphicsConfiguration</code> 1892N/A * @return the insets of this toolkit's screen, in pixels. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Determines the color model of this toolkit's screen. 1892N/A * <code>ColorModel</code> is an abstract class that 1892N/A * encapsulates the ability to translate between the 1892N/A * pixel values of an image and its red, green, blue, 1892N/A * This toolkit method is called by the 1892N/A * <code>getColorModel</code> method 1892N/A * of the <code>Component</code> class. 1892N/A * @return the color model of this toolkit's screen. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.image.ColorModel 1892N/A * @see java.awt.Component#getColorModel 1892N/A * Returns the names of the available fonts in this toolkit.<p> 1892N/A * For 1.1, the following font names are deprecated (the replacement 1892N/A * <li>TimesRoman (use Serif) 1892N/A * <li>Helvetica (use SansSerif) 1892N/A * <li>Courier (use Monospaced) 1892N/A * The ZapfDingbats fontname is also deprecated in 1.1 but the characters 1892N/A * are defined in Unicode starting at 0x2700, and as of 1.1 Java supports 1892N/A * @return the names of the available fonts in this toolkit. 1892N/A * @deprecated see {@link java.awt.GraphicsEnvironment#getAvailableFontFamilyNames()} 1892N/A * @see java.awt.GraphicsEnvironment#getAvailableFontFamilyNames() 1892N/A * Gets the screen device metrics for rendering of the font. 1892N/A * @return the screen metrics of the specified font in this toolkit 1892N/A * @deprecated As of JDK version 1.2, replaced by the <code>Font</code> 1892N/A * method <code>getLineMetrics</code>. 1892N/A * @see java.awt.font.LineMetrics 1892N/A * @see java.awt.Font#getLineMetrics 1892N/A * @see java.awt.GraphicsEnvironment#getScreenDevices 1892N/A * Synchronizes this toolkit's graphics state. Some window systems 1892N/A * may do buffering of graphics events. 1892N/A * This method ensures that the display is up-to-date. It is useful 1892N/A * Used internally by the assistive technologies functions; set at 1892N/A * init time and used at load time 1892N/A * Initializes properties related to assistive technologies. 1892N/A * These properties are used both in the loadAssistiveProperties() 1892N/A * function below, as well as other classes in the jdk that depend 1892N/A * on the properties (such as the use of the screen_magnifier_present 1892N/A * property in Java2D hardware acceleration initialization). The 1892N/A * initialization of the properties must be done before the platform- 1892N/A * specific Toolkit class is instantiated so that all necessary 1892N/A * properties are set up properly before any classes dependent upon them 1892N/A // Get accessibility properties 1892N/A // Try loading the per-user accessibility properties file. 1892N/A // Inputstream has been buffered in Properties class 1892N/A // Per-user accessibility properties file does not exist 1892N/A // Try loading the system-wide accessibility properties 1892N/A // file only if a per-user accessibility properties 1892N/A // file does not exist or is empty. 1892N/A // Inputstream has been buffered in Properties class 1892N/A // System-wide accessibility properties file does 1892N/A // Get whether a screen magnifier is present. First check 1892N/A // the system property and then check the properties file. 1892N/A // Get the names of any assistive technolgies to load. First 1892N/A // check the system property and then check the properties 1892N/A * Loads additional classes into the VM, using the property 1892N/A * 'assistive_technologies' specified in the Sun reference 1892N/A * file. The form is "assistive_technologies=..." where 1892N/A * the "..." is a comma-separated list of assistive technology 1892N/A * classes to load. Each class is loaded in the order given 1892N/A * and a single instance of each is created using 1892N/A * Class.forName(class).newInstance(). All errors are handled 1892N/A * via an AWTError exception. 1892N/A * <p>The assumption is made that assistive technology classes are supplied 1892N/A * as part of INSTALLED (as opposed to: BUNDLED) extensions or specified 1892N/A * (and therefore can be loaded using the class loader returned by 1892N/A * a call to <code>ClassLoader.getSystemClassLoader</code>, whose 1892N/A * delegation parent is the extension class loader for installed 1892N/A // Load any assistive technologies 1892N/A * Gets the default toolkit. 1892N/A * If a system property named <code>"java.awt.headless"</code> is set 1892N/A * to <code>true</code> then the headless implementation 1892N/A * of <code>Toolkit</code> is used. 1892N/A * If there is no <code>"java.awt.headless"</code> or it is set to 1892N/A * <code>false</code> and there is a system property named 1892N/A * <code>"awt.toolkit"</code>, 1892N/A * that property is treated as the name of a class that is a subclass 1892N/A * otherwise the default platform-specific implementation of 1892N/A * <code>Toolkit</code> is used. 1892N/A * Also loads additional classes into the VM, using the property 1892N/A * 'assistive_technologies' specified in the Sun reference 1892N/A * file. The form is "assistive_technologies=..." where 1892N/A * the "..." is a comma-separated list of assistive technology 1892N/A * classes to load. Each class is loaded in the order given 1892N/A * and a single instance of each is created using 1892N/A * Class.forName(class).newInstance(). This is done just after 1892N/A * the AWT toolkit is created. All errors are handled via an 1892N/A * @return the default toolkit. 1892N/A * @exception AWTError if a toolkit could not be found, or 1892N/A * if one could not be accessed or instantiated. 1892N/A // We disable the JIT during toolkit initialization. This 1892N/A // tends to touch lots of classes that aren't needed again 1892N/A // later and therefore JITing is counter-productiive. 1892N/A // Make sure to always re-enable the JIT. 1892N/A * Returns an image which gets pixel data from the specified file, 1892N/A * whose format can be either GIF, JPEG or PNG. 1892N/A * The underlying toolkit attempts to resolve multiple requests 1892N/A * with the same filename to the same returned Image. 1892N/A * Since the mechanism required to facilitate this sharing of 1892N/A * <code>Image</code> objects may continue to hold onto images 1892N/A * that are no longer in use for an indefinite period of time, 1892N/A * developers are encouraged to implement their own caching of 1892N/A * images by using the {@link #createImage(java.lang.String) createImage} 1892N/A * variant wherever available. 1892N/A * If the image data contained in the specified file changes, 1892N/A * the <code>Image</code> object returned from this method may 1892N/A * still contain stale information which was loaded from the 1892N/A * Previously loaded image data can be manually discarded by 1892N/A * calling the {@link Image#flush flush} method on the 1892N/A * returned <code>Image</code>. 1892N/A * This method first checks if there is a security manager installed. 1892N/A * If so, the method calls the security manager's 1892N/A * <code>checkRead</code> method with the file specified to ensure 1892N/A * that the access to the image is allowed. 1892N/A * @param filename the name of a file containing pixel data 1892N/A * in a recognized file format. 1892N/A * @return an image which gets its pixel data from 1892N/A * @throws SecurityException if a security manager exists and its 1892N/A * checkRead method doesn't allow the operation. 1892N/A * @see #createImage(java.lang.String) 1892N/A * Returns an image which gets pixel data from the specified URL. 1892N/A * The pixel data referenced by the specified URL must be in one 1892N/A * of the following formats: GIF, JPEG or PNG. 1892N/A * The underlying toolkit attempts to resolve multiple requests 1892N/A * with the same URL to the same returned Image. 1892N/A * Since the mechanism required to facilitate this sharing of 1892N/A * <code>Image</code> objects may continue to hold onto images 1892N/A * that are no longer in use for an indefinite period of time, 1892N/A * developers are encouraged to implement their own caching of 1892N/A * images by using the {@link #createImage(java.net.URL) createImage} 1892N/A * variant wherever available. 1892N/A * If the image data stored at the specified URL changes, 1892N/A * the <code>Image</code> object returned from this method may 1892N/A * still contain stale information which was fetched from the 1892N/A * Previously loaded image data can be manually discarded by 1892N/A * calling the {@link Image#flush flush} method on the 1892N/A * returned <code>Image</code>. 1892N/A * This method first checks if there is a security manager installed. 1892N/A * If so, the method calls the security manager's 1892N/A * <code>checkPermission</code> method with the 1892N/A * url.openConnection().getPermission() permission to ensure 1892N/A * that the access to the image is allowed. For compatibility 1892N/A * with pre-1.2 security managers, if the access is denied with 1892N/A * <code>FilePermission</code> or <code>SocketPermission</code>, 1892N/A * the method throws the <code>SecurityException</code> 1892N/A * if the corresponding 1.1-style SecurityManager.checkXXX method 1892N/A * @param url the URL to use in fetching the pixel data. 1892N/A * @return an image which gets its pixel data from 1892N/A * @throws SecurityException if a security manager exists and its 1892N/A * checkPermission method doesn't allow 1892N/A * @see #createImage(java.net.URL) 1892N/A * Returns an image which gets pixel data from the specified file. 1892N/A * The returned Image is a new object which will not be shared 1892N/A * with any other caller of this method or its getImage variant. 1892N/A * This method first checks if there is a security manager installed. 1892N/A * If so, the method calls the security manager's 1892N/A * <code>checkRead</code> method with the specified file to ensure 1892N/A * that the image creation is allowed. 1892N/A * @param filename the name of a file containing pixel data 1892N/A * in a recognized file format. 1892N/A * @return an image which gets its pixel data from 1892N/A * @throws SecurityException if a security manager exists and its 1892N/A * checkRead method doesn't allow the operation. 1892N/A * @see #getImage(java.lang.String) 1892N/A * Returns an image which gets pixel data from the specified URL. 1892N/A * The returned Image is a new object which will not be shared 1892N/A * with any other caller of this method or its getImage variant. 1892N/A * This method first checks if there is a security manager installed. 1892N/A * If so, the method calls the security manager's 1892N/A * <code>checkPermission</code> method with the 1892N/A * url.openConnection().getPermission() permission to ensure 1892N/A * that the image creation is allowed. For compatibility 1892N/A * with pre-1.2 security managers, if the access is denied with 1892N/A * <code>FilePermission</code> or <code>SocketPermission</code>, 1892N/A * the method throws <code>SecurityException</code> 1892N/A * if the corresponding 1.1-style SecurityManager.checkXXX method 1892N/A * @param url the URL to use in fetching the pixel data. 1892N/A * @return an image which gets its pixel data from 1892N/A * @throws SecurityException if a security manager exists and its 1892N/A * checkPermission method doesn't allow 1892N/A * @see #getImage(java.net.URL) 1892N/A * Prepares an image for rendering. 1892N/A * If the values of the width and height arguments are both 1892N/A * <code>-1</code>, this method prepares the image for rendering 1892N/A * on the default screen; otherwise, this method prepares an image 1892N/A * for rendering on the default screen at the specified width and height. 1892N/A * The image data is downloaded asynchronously in another thread, 1892N/A * and an appropriately scaled screen representation of the image is 1892N/A * This method is called by components <code>prepareImage</code> 1892N/A * Information on the flags returned by this method can be found 1892N/A * with the definition of the <code>ImageObserver</code> interface. 1892N/A * @param image the image for which to prepare a 1892N/A * @param width the width of the desired screen 1892N/A * representation, or <code>-1</code>. 1892N/A * @param height the height of the desired screen 1892N/A * representation, or <code>-1</code>. 1892N/A * @param observer the <code>ImageObserver</code> 1892N/A * object to be notified as the 1892N/A * @return <code>true</code> if the image has already been 1892N/A * fully prepared; <code>false</code> otherwise. 1892N/A * @see java.awt.Component#prepareImage(java.awt.Image, 1892N/A * java.awt.image.ImageObserver) 1892N/A * @see java.awt.Component#prepareImage(java.awt.Image, 1892N/A * int, int, java.awt.image.ImageObserver) 1892N/A * @see java.awt.image.ImageObserver 1892N/A * Indicates the construction status of a specified image that is 1892N/A * being prepared for display. 1892N/A * If the values of the width and height arguments are both 1892N/A * <code>-1</code>, this method returns the construction status of 1892N/A * a screen representation of the specified image in this toolkit. 1892N/A * Otherwise, this method returns the construction status of a 1892N/A * scaled representation of the image at the specified width 1892N/A * This method does not cause the image to begin loading. 1892N/A * An application must call <code>prepareImage</code> to force 1892N/A * This method is called by the component's <code>checkImage</code> 1892N/A * Information on the flags returned by this method can be found 1892N/A * with the definition of the <code>ImageObserver</code> interface. 1892N/A * @param image the image whose status is being checked. 1892N/A * @param width the width of the scaled version whose status is 1892N/A * being checked, or <code>-1</code>. 1892N/A * @param height the height of the scaled version whose status 1892N/A * is being checked, or <code>-1</code>. 1892N/A * @param observer the <code>ImageObserver</code> object to be 1892N/A * notified as the image is being prepared. 1892N/A * @return the bitwise inclusive <strong>OR</strong> of the 1892N/A * <code>ImageObserver</code> flags for the 1892N/A * image data that is currently available. 1892N/A * @see java.awt.Toolkit#prepareImage(java.awt.Image, 1892N/A * int, int, java.awt.image.ImageObserver) 1892N/A * @see java.awt.Component#checkImage(java.awt.Image, 1892N/A * java.awt.image.ImageObserver) 1892N/A * @see java.awt.Component#checkImage(java.awt.Image, 1892N/A * int, int, java.awt.image.ImageObserver) 1892N/A * @see java.awt.image.ImageObserver 1892N/A * Creates an image with the specified image producer. 1892N/A * @param producer the image producer to be used. 1892N/A * @return an image with the specified image producer. 1892N/A * @see java.awt.image.ImageProducer 1892N/A * @see java.awt.Component#createImage(java.awt.image.ImageProducer) 1892N/A * Creates an image which decodes the image stored in the specified 1892N/A * The data must be in some image format, such as GIF or JPEG, 1892N/A * that is supported by this toolkit. 1892N/A * @param imagedata an array of bytes, representing 1892N/A * image data in a supported image format. 1892N/A * Creates an image which decodes the image stored in the specified 1892N/A * byte array, and at the specified offset and length. 1892N/A * The data must be in some image format, such as GIF or JPEG, 1892N/A * that is supported by this toolkit. 1892N/A * @param imagedata an array of bytes, representing 1892N/A * image data in a supported image format. 1892N/A * @param imageoffset the offset of the beginning 1892N/A * of the data in the array. 1892N/A * @param imagelength the length of the data in the array. 1892N/A * Gets a <code>PrintJob</code> object which is the result of initiating 1892N/A * a print operation on the toolkit's platform. 1892N/A * Each actual implementation of this method should first check if there 1892N/A * is a security manager installed. If there is, the method should call 1892N/A * the security manager's <code>checkPrintJobAccess</code> method to 1892N/A * ensure initiation of a print operation is allowed. If the default 1892N/A * implementation of <code>checkPrintJobAccess</code> is used (that is, 1892N/A * that method is not overriden), then this results in a call to the 1892N/A * security manager's <code>checkPermission</code> method with a <code> 1892N/A * RuntimePermission("queuePrintJob")</code> permission. 1892N/A * @param frame the parent of the print dialog. May not be null. 1892N/A * @param jobtitle the title of the PrintJob. A null title is equivalent 1892N/A * @param props a Properties object containing zero or more properties. 1892N/A * Properties are not standardized and are not consistent across 1892N/A * implementations. Because of this, PrintJobs which require job 1892N/A * and page control should use the version of this function which 1892N/A * takes JobAttributes and PageAttributes objects. This object 1892N/A * may be updated to reflect the user's job choices on exit. May 1892N/A * @return a <code>PrintJob</code> object, or <code>null</code> if the 1892N/A * user cancelled the print job. 1892N/A * @throws NullPointerException if frame is null. This exception is 1892N/A * always thrown when GraphicsEnvironment.isHeadless() returns 1892N/A * @throws SecurityException if this thread is not allowed to initiate a 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.lang.RuntimePermission 1892N/A * Gets a <code>PrintJob</code> object which is the result of initiating 1892N/A * a print operation on the toolkit's platform. 1892N/A * Each actual implementation of this method should first check if there 1892N/A * is a security manager installed. If there is, the method should call 1892N/A * the security manager's <code>checkPrintJobAccess</code> method to 1892N/A * ensure initiation of a print operation is allowed. If the default 1892N/A * implementation of <code>checkPrintJobAccess</code> is used (that is, 1892N/A * that method is not overriden), then this results in a call to the 1892N/A * security manager's <code>checkPermission</code> method with a <code> 1892N/A * RuntimePermission("queuePrintJob")</code> permission. 1892N/A * @param frame the parent of the print dialog. May be null if and only 1892N/A * if jobAttributes is not null and jobAttributes.getDialog() 1892N/A * returns JobAttributes.DialogType.NONE or 1892N/A * JobAttributes.DialogType.COMMON. 1892N/A * @param jobtitle the title of the PrintJob. A null title is equivalent 1892N/A * @param jobAttributes a set of job attributes which will control the 1892N/A * PrintJob. The attributes will be updated to reflect the user's 1892N/A * choices as outlined in the JobAttributes documentation. May be 1892N/A * @param pageAttributes a set of page attributes which will control the 1892N/A * PrintJob. The attributes will be applied to every page in the 1892N/A * job. The attributes will be updated to reflect the user's 1892N/A * choices as outlined in the PageAttributes documentation. May be 1892N/A * @return a <code>PrintJob</code> object, or <code>null</code> if the 1892N/A * user cancelled the print job. 1892N/A * @throws NullPointerException if frame is null and either jobAttributes 1892N/A * is null or jobAttributes.getDialog() returns 1892N/A * JobAttributes.DialogType.NATIVE. 1892N/A * @throws IllegalArgumentException if pageAttributes specifies differing 1892N/A * cross feed and feed resolutions. Also if this thread has 1892N/A * access to the file system and jobAttributes specifies 1892N/A * print to file, and the specified destination file exists but 1892N/A * is a directory rather than a regular file, does not exist but 1892N/A * cannot be created, or cannot be opened for any other reason. 1892N/A * However in the case of print to file, if a dialog is also 1892N/A * requested to be displayed then the user will be given an 1892N/A * opportunity to select a file and proceed with printing. 1892N/A * The dialog will ensure that the selected output file 1892N/A * is valid before returning from this method. 1892N/A * This exception is always thrown when GraphicsEnvironment.isHeadless() 1892N/A * @throws SecurityException if this thread is not allowed to initiate a 1892N/A * print job request, or if jobAttributes specifies print to file, 1892N/A * and this thread is not allowed to access the file system 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.lang.RuntimePermission 1892N/A * @see java.awt.JobAttributes 1892N/A * @see java.awt.PageAttributes 1892N/A // Override to add printing support with new job/page control classes 1892N/A * Gets the singleton instance of the system Clipboard which interfaces 1892N/A * with clipboard facilities provided by the native platform. This 1892N/A * clipboard enables data transfer between Java programs and native 1892N/A * applications which use native clipboard facilities. 1892N/A * file, or other file specified by the <code>AWT.DnD.flavorMapFileURL 1892N/A * </code> Toolkit property, text returned by the system Clipboard's <code> 1892N/A * getTransferData()</code> method is available in the following flavors: 1892N/A * <li>DataFlavor.stringFlavor</li> 1892N/A * <li>DataFlavor.plainTextFlavor (<b>deprecated</b>)</li> 1892N/A * As with <code>java.awt.datatransfer.StringSelection</code>, if the 1892N/A * requested flavor is <code>DataFlavor.plainTextFlavor</code>, or an 1892N/A * equivalent flavor, a Reader is returned. <b>Note:</b> The behavior of 1892N/A * the system Clipboard's <code>getTransferData()</code> method for <code> 1892N/A * DataFlavor.plainTextFlavor</code>, and equivalent DataFlavors, is 1892N/A * inconsistent with the definition of <code>DataFlavor.plainTextFlavor 1892N/A * </code>. Because of this, support for <code> 1892N/A * DataFlavor.plainTextFlavor</code>, and equivalent flavors, is 1892N/A * Each actual implementation of this method should first check if there 1892N/A * is a security manager installed. If there is, the method should call 1892N/A * the security manager's <code>checkSystemClipboardAccess</code> method 1892N/A * to ensure it's ok to to access the system clipboard. If the default 1892N/A * implementation of <code>checkSystemClipboardAccess</code> is used (that 1892N/A * is, that method is not overriden), then this results in a call to the 1892N/A * security manager's <code>checkPermission</code> method with an <code> 1892N/A * AWTPermission("accessClipboard")</code> permission. 1892N/A * @return the system Clipboard 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.datatransfer.Clipboard 1892N/A * @see java.awt.datatransfer.StringSelection 1892N/A * @see java.awt.datatransfer.DataFlavor#stringFlavor 1892N/A * @see java.awt.datatransfer.DataFlavor#plainTextFlavor 1892N/A * @see java.awt.AWTPermission 1892N/A * Gets the singleton instance of the system selection as a 1892N/A * <code>Clipboard</code> object. This allows an application to read and 1892N/A * modify the current, system-wide selection. 1892N/A * An application is responsible for updating the system selection whenever 1892N/A * the user selects text, using either the mouse or the keyboard. 1892N/A * Typically, this is implemented by installing a 1892N/A * <code>FocusListener</code> on all <code>Component</code>s which support 1892N/A * text selection, and, between <code>FOCUS_GAINED</code> and 1892N/A * <code>FOCUS_LOST</code> events delivered to that <code>Component</code>, 1892N/A * updating the system selection <code>Clipboard</code> when the selection 1892N/A * changes inside the <code>Component</code>. Properly updating the system 1892N/A * selection ensures that a Java application will interact correctly with 1892N/A * native applications and other Java applications running simultaneously 1892N/A * on the system. Note that <code>java.awt.TextComponent</code> and 1892N/A * <code>javax.swing.text.JTextComponent</code> already adhere to this 1892N/A * policy. When using these classes, and their subclasses, developers need 1892N/A * not write any additional code. 1892N/A * Some platforms do not support a system selection <code>Clipboard</code>. 1892N/A * On those platforms, this method will return <code>null</code>. In such a 1892N/A * case, an application is absolved from its responsibility to update the 1892N/A * system selection <code>Clipboard</code> as described above. 1892N/A * Each actual implementation of this method should first check if there 1892N/A * is a <code>SecurityManager</code> installed. If there is, the method 1892N/A * should call the <code>SecurityManager</code>'s 1892N/A * <code>checkSystemClipboardAccess</code> method to ensure that client 1892N/A * code has access the system selection. If the default implementation of 1892N/A * <code>checkSystemClipboardAccess</code> is used (that is, if the method 1892N/A * is not overridden), then this results in a call to the 1892N/A * <code>SecurityManager</code>'s <code>checkPermission</code> method with 1892N/A * an <code>AWTPermission("accessClipboard")</code> permission. 1892N/A * @return the system selection as a <code>Clipboard</code>, or 1892N/A * <code>null</code> if the native platform does not support a 1892N/A * system selection <code>Clipboard</code> 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.datatransfer.Clipboard 1892N/A * @see java.awt.event.FocusListener 1892N/A * @see java.awt.event.FocusEvent#FOCUS_GAINED 1892N/A * @see java.awt.event.FocusEvent#FOCUS_LOST 1892N/A * @see javax.swing.text.JTextComponent 1892N/A * @see GraphicsEnvironment#isHeadless 1892N/A * Determines which modifier key is the appropriate accelerator 1892N/A * Menu shortcuts, which are embodied in the 1892N/A * <code>MenuShortcut</code> class, are handled by the 1892N/A * <code>MenuBar</code> class. 1892N/A * By default, this method returns <code>Event.CTRL_MASK</code>. 1892N/A * Toolkit implementations should override this method if the 1892N/A * <b>Control</b> key isn't the correct key for accelerators. 1892N/A * @return the modifier mask on the <code>Event</code> class 1892N/A * that is used for menu shortcuts on this toolkit. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * @see java.awt.MenuShortcut 1892N/A * Returns whether the given locking key on the keyboard is currently in 1892N/A * {@link java.awt.event.KeyEvent#VK_CAPS_LOCK VK_CAPS_LOCK}, 1892N/A * {@link java.awt.event.KeyEvent#VK_NUM_LOCK VK_NUM_LOCK}, 1892N/A * {@link java.awt.event.KeyEvent#VK_SCROLL_LOCK VK_SCROLL_LOCK}, and 1892N/A * {@link java.awt.event.KeyEvent#VK_KANA_LOCK VK_KANA_LOCK}. 1892N/A * @exception java.lang.IllegalArgumentException if <code>keyCode</code> 1892N/A * is not one of the valid key codes 1892N/A * @exception java.lang.UnsupportedOperationException if the host system doesn't 1892N/A * allow getting the state of this key programmatically, or if the keyboard 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Sets the state of the given locking key on the keyboard. 1892N/A * {@link java.awt.event.KeyEvent#VK_CAPS_LOCK VK_CAPS_LOCK}, 1892N/A * {@link java.awt.event.KeyEvent#VK_NUM_LOCK VK_NUM_LOCK}, 1892N/A * {@link java.awt.event.KeyEvent#VK_SCROLL_LOCK VK_SCROLL_LOCK}, and 1892N/A * {@link java.awt.event.KeyEvent#VK_KANA_LOCK VK_KANA_LOCK}. 1892N/A * Depending on the platform, setting the state of a locking key may 1892N/A * involve event processing and therefore may not be immediately 1892N/A * observable through getLockingKeyState. 1892N/A * @exception java.lang.IllegalArgumentException if <code>keyCode</code> 1892N/A * is not one of the valid key codes 1892N/A * @exception java.lang.UnsupportedOperationException if the host system doesn't 1892N/A * allow setting the state of this key programmatically, or if the keyboard 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Give native peers the ability to query the native container 1892N/A * given a native component (eg the direct parent may be lightweight). 1892N/A * Creates a new custom cursor object. 1892N/A * If the image to display is invalid, the cursor will be hidden (made 1892N/A * completely transparent), and the hotspot will be set to (0, 0). 1892N/A * <p>Note that multi-frame images are invalid and may cause this 1892N/A * @param cursor the image to display when the cursor is actived 1892N/A * @param hotSpot the X and Y of the large cursor's hot spot; the 1892N/A * hotSpot values must be less than the Dimension returned by 1892N/A * <code>getBestCursorSize</code> 1892N/A * @param name a localized description of the cursor, for Java Accessibility use 1892N/A * @exception IndexOutOfBoundsException if the hotSpot values are outside 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A // Override to implement custom cursor support. 1892N/A * Returns the supported cursor dimension which is closest to the desired 1892N/A * sizes. Systems which only support a single cursor size will return that 1892N/A * size regardless of the desired sizes. Systems which don't support custom 1892N/A * cursors will return a dimension of 0, 0. <p> 1892N/A * Note: if an image is used whose dimensions don't match a supported size 1892N/A * (as returned by this method), the Toolkit implementation will attempt to 1892N/A * resize the image to a supported size. 1892N/A * Since converting low-resolution images is difficult, 1892N/A * no guarantees are made as to the quality of a cursor image which isn't a 1892N/A * supported size. It is therefore recommended that this method 1892N/A * be called and an appropriate image used so no image conversion is made. 1892N/A * @param preferredWidth the preferred cursor width the component would like 1892N/A * @param preferredHeight the preferred cursor height the component would like 1892N/A * @return the closest matching supported cursor size, or a dimension of 0,0 if 1892N/A * the Toolkit implementation doesn't support custom cursors. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A // Override to implement custom cursor support. 1892N/A * Returns the maximum number of colors the Toolkit supports in a custom cursor 1892N/A * Note: if an image is used which has more colors in its palette than 1892N/A * the supported maximum, the Toolkit implementation will attempt to flatten the 1892N/A * palette to the maximum. Since converting low-resolution images is difficult, 1892N/A * no guarantees are made as to the quality of a cursor image which has more 1892N/A * colors than the system supports. It is therefore recommended that this method 1892N/A * be called and an appropriate image used so no image conversion is made. 1892N/A * @return the maximum number of colors, or zero if custom cursors are not 1892N/A * supported by this Toolkit implementation. 1892N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A // Override to implement custom cursor support. 1892N/A * Returns whether Toolkit supports this state for 1892N/A * <code>Frame</code>s. This method tells whether the <em>UI 1892N/A * concept</em> of, say, maximization or iconification is 1892N/A * supported. It will always return false for "compound" states 1892N/A * like <code>Frame.ICONIFIED|Frame.MAXIMIZED_VERT</code>. 1892N/A * In other words, the rule of thumb is that only queries with a 1892N/A * single frame state constant as an argument are meaningful. 1892N/A * <p>Note that supporting a given concept is a platform- 1892N/A * dependent feature. Due to native limitations the Toolkit 1892N/A * object may report a particular state as supported, however at 1892N/A * the same time the Toolkit object will be unable to apply the 1892N/A * state to a given frame. This circumstance has two following 1892N/A * <li>Only the return value of {@code false} for the present 1892N/A * method actually indicates that the given state is not 1892N/A * supported. If the method returns {@code true} the given state 1892N/A * may still be unsupported and/or unavailable for a particular 1892N/A * <li>The developer should consider examining the value of the 1892N/A * {@link java.awt.event.WindowEvent#getNewState} method of the 1892N/A * {@code WindowEvent} received through the {@link 1892N/A * java.awt.event.WindowStateListener}, rather than assuming 1892N/A * that the state given to the {@code setExtendedState()} method 1892N/A * will be definitely applied. For more information see the 1892N/A * documentation for the {@link Frame#setExtendedState} method. 1892N/A * @param state one of named frame state constants. 1892N/A * @return <code>true</code> is this frame state is supported by 1892N/A * this Toolkit implementation, <code>false</code> otherwise. 1892N/A * @exception HeadlessException 1892N/A * if <code>GraphicsEnvironment.isHeadless()</code> 1892N/A * returns <code>true</code>. 1892N/A * @see java.awt.Window#addWindowStateListener 1892N/A * Support for I18N: any visible strings should be stored in 1892N/A * here, so that only one copy is maintained. 1892N/A * Initialize JNI field and method ids 1892N/A * WARNING: This is a temporary workaround for a problem in the 1892N/A * way the AWT loads native libraries. A number of classes in the 1892N/A * AWT package have a native method, initIDs(), which initializes 1892N/A * the JNI field and method ids used in the native portion of 1892N/A * Since the use and storage of these ids is done by the 1892N/A * implementation libraries, the implementation of these method is 1892N/A * provided by the particular AWT implementations (for example, 1892N/A * "Toolkit"s/Peer), such as Motif, Microsoft Windows, or Tiny. The 1892N/A * problem is that this means that the native libraries must be 1892N/A * loaded by the java.* classes, which do not necessarily know the 1892N/A * names of the libraries to load. A better way of doing this 1892N/A * would be to provide a separate library which defines java.awt.* 1892N/A * initIDs, and exports the relevant symbols out to the 1892N/A * implementation libraries. 1892N/A * For now, we know it's done by the implementation, and we assume 1892N/A * that the name of the library is "awt". -br. 1892N/A * If you change loadLibraries(), please add the change to 1892N/A * java.awt.image.ColorModel.loadLibraries(). Unfortunately, 1892N/A * classes can be loaded in java.awt.image that depend on 1892N/A * libawt and there is no way to call Toolkit.loadLibraries() 1892N/A // No resource file; defaults will be used. 1892N/A // ensure that the proper libraries are loaded 1892N/A * Gets a property with the specified key and default. 1892N/A * This method returns defaultValue if the property is not found. 1892N/A * Get the application's or applet's EventQueue instance. 1892N/A * Depending on the Toolkit implementation, different EventQueues 1892N/A * may be returned for different applets. Applets should 1892N/A * therefore not assume that the EventQueue instance returned 1892N/A * by this method will be shared by other applets or the system. 1892N/A * <p>First, if there is a security manager, its 1892N/A * <code>checkAwtEventQueueAccess</code> 1892N/A * If the default implementation of <code>checkAwtEventQueueAccess</code> 1892N/A * is used (that is, that method is not overriden), then this results in 1892N/A * a call to the security manager's <code>checkPermission</code> method 1892N/A * with an <code>AWTPermission("accessEventQueue")</code> permission. 1892N/A * @return the <code>EventQueue</code> object 1892N/A * @throws SecurityException 1892N/A * if a security manager exists and its <code>{@link 1892N/A * java.lang.SecurityManager#checkAwtEventQueueAccess}</code> 1892N/A * method denies access to the <code>EventQueue</code> 1892N/A * @see java.awt.AWTPermission 1892N/A * Gets the application's or applet's <code>EventQueue</code> 1892N/A * instance, without checking access. For security reasons, 1892N/A * this can only be called from a <code>Toolkit</code> subclass. 1892N/A * @return the <code>EventQueue</code> object 1892N/A /* Accessor method for use by AWT package routines. */ 1892N/A * Creates the peer for a DragSourceContext. 1892N/A * Always throws InvalidDndOperationException if 1892N/A * GraphicsEnvironment.isHeadless() returns true. 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Creates a concrete, platform dependent, subclass of the abstract 1892N/A * DragGestureRecognizer class requested, and associates it with the 1892N/A * DragSource, Component and DragGestureListener specified. 1892N/A * subclasses should override this to provide their own implementation 1892N/A * @param abstractRecognizerClass The abstract class of the required recognizer 1892N/A * @param c The Component target for the DragGestureRecognizer 1892N/A * @param srcActions The actions permitted for the gesture 1892N/A * @param dgl The DragGestureListener 1892N/A * @return the new object or null. Always returns null if 1892N/A * GraphicsEnvironment.isHeadless() returns true. 1892N/A * @see java.awt.GraphicsEnvironment#isHeadless 1892N/A * Obtains a value for the specified desktop property. 1892N/A * A desktop property is a uniquely named value for a resource that 1892N/A * is Toolkit global in nature. Usually it also is an abstract 1892N/A * representation for an underlying platform dependent desktop setting. 1892N/A * For more information on desktop properties supported by the AWT see 1892N/A // This is a workaround for headless toolkits. It would be 1892N/A // better to override this method but it is declared final. 1892N/A // "this instanceof" syntax defeats polymorphism. 1892N/A // This property should never be cached 1892N/A /* for property "awt.font.desktophints" */ 1892N/A * Sets the named desktop property to the specified value and fires a 1892N/A * property change event to notify any listeners that the value has changed. 1892N/A // This is a workaround for headless toolkits. It would be 1892N/A // better to override this method but it is declared final. 1892N/A // "this instanceof" syntax defeats polymorphism. 1892N/A * an opportunity to lazily evaluate desktop property values. 1892N/A * initializeDesktopProperties 1892N/A * Adds the specified property change listener for the named desktop 1892N/A * If pcl is null, no exception is thrown and no action is performed. 1892N/A * @param name The name of the property to listen for 1892N/A * @param pcl The property change listener 1892N/A * Removes the specified property change listener for the named 1892N/A * If pcl is null, no exception is thrown and no action is performed. 1892N/A * @param name The name of the property to remove 1892N/A * @param pcl The property change listener 1892N/A * Returns an array of all the property change listeners 1892N/A * registered on this toolkit. 1892N/A * @return all of this toolkit's <code>PropertyChangeListener</code>s 1892N/A * or an empty array if no property change 1892N/A * listeners are currently registered 1892N/A * Returns an array of all the <code>PropertyChangeListener</code>s 1892N/A * associated with the named property. 1892N/A * @param propertyName the named property 1892N/A * @return all of the <code>PropertyChangeListener</code>s associated with 1892N/A * the named property or an empty array if no such listeners have 1892N/A * Returns whether the always-on-top mode is supported by this toolkit. 1892N/A * To detect whether the always-on-top mode is supported for a 1892N/A * particular Window, use {@link Window#isAlwaysOnTopSupported}. 1892N/A * @return <code>true</code>, if current toolkit supports the always-on-top mode, 1892N/A * otherwise returns <code>false</code> 1892N/A * @see Window#isAlwaysOnTopSupported 1892N/A * @see Window#setAlwaysOnTop(boolean) 1892N/A * Returns whether the given modality type is supported by this toolkit. If 1892N/A * a dialog with unsupported modality type is created, then 1892N/A * <code>Dialog.ModalityType.MODELESS</code> is used instead. 1892N/A * @param modalityType modality type to be checked for support by this toolkit 1892N/A * @return <code>true</code>, if current toolkit supports given modality 1892N/A * type, <code>false</code> otherwise 1892N/A * @see java.awt.Dialog.ModalityType 1892N/A * @see java.awt.Dialog#getModalityType 1892N/A * @see java.awt.Dialog#setModalityType 1892N/A * Returns whether the given modal exclusion type is supported by this 1892N/A * toolkit. If an unsupported modal exclusion type property is set on a window, 1892N/A * then <code>Dialog.ModalExclusionType.NO_EXCLUDE</code> is used instead. 1892N/A * @param modalExclusionType modal exclusion type to be checked for support by this toolkit 1892N/A * @return <code>true</code>, if current toolkit supports given modal exclusion 1892N/A * type, <code>false</code> otherwise 1892N/A * @see java.awt.Dialog.ModalExclusionType 1892N/A * @see java.awt.Window#getModalExclusionType 1892N/A * @see java.awt.Window#setModalExclusionType 1892N/A * Extracts a "pure" AWTEventListener from a AWTEventListenerProxy, 1892N/A * if the listener is proxied. 1892N/A // if user passed in a AWTEventListenerProxy object, extract 1892N/A * Adds an AWTEventListener to receive all AWTEvents dispatched 1892N/A * system-wide that conform to the given <code>eventMask</code>. 1892N/A * First, if there is a security manager, its <code>checkPermission</code> 1892N/A * <code>AWTPermission("listenToAllAWTEvents")</code> permission. 1892N/A * This may result in a SecurityException. 1892N/A * <code>eventMask</code> is a bitmask of event types to receive. 1892N/A * It is constructed by bitwise OR-ing together the event masks 1892N/A * defined in <code>AWTEvent</code>. 1892N/A * Note: event listener use is not recommended for normal 1892N/A * application use, but are intended solely to support special 1892N/A * purpose facilities including support for accessibility, 1892N/A * If listener is null, no exception is thrown and no action is performed. 1892N/A * @param listener the event listener. 1892N/A * @param eventMask the bitmask of event types to receive 1892N/A * @throws SecurityException 1892N/A * if a security manager exists and its 1892N/A * <code>checkPermission</code> method doesn't allow the operation. 1892N/A * @see #removeAWTEventListener 1892N/A * @see #getAWTEventListeners 1892N/A * @see SecurityManager#checkPermission 1892N/A * @see java.awt.AWTPermission 1892N/A * @see java.awt.event.AWTEventListener 1892N/A * @see java.awt.event.AWTEventListenerProxy 1892N/A // Create a new selectiveListener. 1892N/A // OR the eventMask into the selectiveListener's event mask. 1892N/A // If no bits are set, break out of loop. 1892N/A mask >>>=
1;
// Right shift, fill with zeros on left. 1892N/A * Removes an AWTEventListener from receiving dispatched AWTEvents. 1892N/A * First, if there is a security manager, its <code>checkPermission</code> 1892N/A * <code>AWTPermission("listenToAllAWTEvents")</code> permission. 1892N/A * This may result in a SecurityException. 1892N/A * Note: event listener use is not recommended for normal 1892N/A * application use, but are intended solely to support special 1892N/A * purpose facilities including support for accessibility, 1892N/A * If listener is null, no exception is thrown and no action is performed. 1892N/A * @param listener the event listener. 1892N/A * @throws SecurityException 1892N/A * if a security manager exists and its * <code>checkPermission</code> method doesn't allow the operation. * @see #addAWTEventListener * @see #getAWTEventListeners * @see SecurityManager#checkPermission * @see java.awt.AWTPermission * @see java.awt.event.AWTEventListener * @see java.awt.event.AWTEventListenerProxy assert calls[i] >=
0:
"Negative Listeners count";
* Returns an array of all the <code>AWTEventListener</code>s * registered on this toolkit. * If there is a security manager, its {@code checkPermission} * method is called with an * {@code AWTPermission("listenToAllAWTEvents")} permission. * This may result in a SecurityException. * Listeners can be returned * within <code>AWTEventListenerProxy</code> 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. * @return all of the <code>AWTEventListener</code>s or an empty * array if no listeners are currently registered * @throws SecurityException * if a security manager exists and its * <code>checkPermission</code> method doesn't allow the operation. * @see #addAWTEventListener * @see #removeAWTEventListener * @see SecurityManager#checkPermission * @see java.awt.AWTPermission * @see java.awt.event.AWTEventListener * @see java.awt.event.AWTEventListenerProxy //assert tempL is not an AWTEventListenerProxy - we should // have weeded them all out // don't want to wrap a proxy inside a proxy * Returns an array of all the <code>AWTEventListener</code>s * registered on this toolkit which listen to all of the event * types specified in the {@code eventMask} argument. * If there is a security manager, its {@code checkPermission} * method is called with an * {@code AWTPermission("listenToAllAWTEvents")} permission. * This may result in a SecurityException. * Listeners can be returned * within <code>AWTEventListenerProxy</code> 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. * @param eventMask the bitmask of event types to listen for * @return all of the <code>AWTEventListener</code>s registered * on this toolkit for the specified * event types, or an empty array if no such listeners * are currently registered * @throws SecurityException * if a security manager exists and its * <code>checkPermission</code> method doesn't allow the operation. * @see #addAWTEventListener * @see #removeAWTEventListener * @see SecurityManager#checkPermission * @see java.awt.AWTPermission * @see java.awt.event.AWTEventListener * @see java.awt.event.AWTEventListenerProxy //AWTEventListener tempL = sael.getListener(); * This method notifies any AWTEventListeners that an event * is about to be dispatched. * @param theEvent the event which will be dispatched. // This is a workaround for headless toolkits. It would be // better to override this method but it is declared package private. // "this instanceof" syntax defeats polymorphism. // Implementation cloned from AWTEventMulticaster. // #4178589: must overload remove(EventListener) to call our add() // instead of the static addInternal() so we allocate a // ToolkitEventMulticaster instead of an AWTEventMulticaster. // Note: this method is called by AWTEventListener.removeInternal(), // so its method signature must match AWTEventListener.remove(). if (
a2 == a &&
b2 == b) {
return this;
// it's not here // This array contains the number of times to call the eventlistener // For each event bit set in mask, increment its call count. // If no bits are set, break out of loop. if ((
mask &
1L) !=
0) {
// Always test bit 0. mask >>>=
1;
// Right shift, fill with zeros on left. long eventBit =
0;
// Used to save the bit of the event type. // Get the index of the call count for this event type. // Instead of using Math.log(...) we will calculate it with // bit shifts. That's what previous implementation looked like: // int ci = (int) (Math.log(eventBit)/Math.log(2)); // Call the listener as many times as it was added for this * Returns a map of visual attributes for the abstract level description * of the given input method highlight, or null if no mapping is found. * The style field of the input method highlight is ignored. The map * returned is unmodifiable. * @param highlight input method highlight * @return style attribute map, or <code>null</code> * @exception HeadlessException if * <code>GraphicsEnvironment.isHeadless</code> returns true * @see java.awt.GraphicsEnvironment#isHeadless * we do expect that all other fireXXX() methods of java.beans.PropertyChangeSupport * use this method. If this will be changed we will need to change this class. * Reports whether events from extra mouse buttons are allowed to be processed and posted into * To change the returned value it is necessary to set the {@code sun.awt.enableExtraMouseButtons} * property before the {@code Toolkit} class initialization. This setting could be done on the application * startup by the following command: * java -Dsun.awt.enableExtraMouseButtons=false Application * Alternatively, the property could be set in the application by using the following code: * System.setProperty("sun.awt.enableExtraMouseButtons", "true"); * before the {@code Toolkit} class initialization. * If not set by the time of the {@code Toolkit} class initialization, this property will be * initialized with {@code true}. * Changing this value after the {@code Toolkit} class initialization will have no effect. * The current value could be queried by using the * {@code System.getProperty("sun.awt.enableExtraMouseButtons")} method. * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true * @return {@code true} if events from extra mouse buttons are allowed to be processed and posted; * {@code false} otherwise * @see System#getProperty(String propertyName) * @see System#setProperty(String propertyName, String value) * @see java.awt.EventQueue