📄 toolkit.java
字号:
{ return null; } /** * Causes a "beep" tone to be generated. */ public abstract void beep(); /** * Returns the system clipboard. * * @return THe system clipboard. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public abstract Clipboard getSystemClipboard(); /** * Gets the singleton instance of the system selection as a Clipboard object. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. * * @since 1.4 */ public Clipboard getSystemSelection() { return null; } /** * Returns the accelerator key mask for menu shortcuts. The default is * <code>Event.CTRL_MASK</code>. A toolkit must override this method * to change the default. * * @return The key mask for the menu accelerator key. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public int getMenuShortcutKeyMask() { return Event.CTRL_MASK; } /** * Returns whether the given locking key on the keyboard is currently in its * "on" state. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. * @exception IllegalArgumentException If keyCode is not one of the valid keys. * @exception UnsupportedOperationException If the host system doesn't allow * getting the state of this key programmatically, or if the keyboard doesn't * have this key. */ public boolean getLockingKeyState(int keyCode) { if (keyCode != KeyEvent.VK_CAPS_LOCK && keyCode != KeyEvent.VK_NUM_LOCK && keyCode != KeyEvent.VK_SCROLL_LOCK) throw new IllegalArgumentException(); throw new UnsupportedOperationException(); } /** * Sets the state of the given locking key on the keyboard. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. * @exception IllegalArgumentException If keyCode is not one of the valid keys. * @exception UnsupportedOperationException If the host system doesn't allow * getting the state of this key programmatically, or if the keyboard doesn't * have this key. */ public void setLockingKeyState(int keyCode, boolean on) { if (keyCode != KeyEvent.VK_CAPS_LOCK && keyCode != KeyEvent.VK_NUM_LOCK && keyCode != KeyEvent.VK_SCROLL_LOCK) throw new IllegalArgumentException(); throw new UnsupportedOperationException(); } /** * Returns the native container object of the specified component. This * method is necessary because the parent component might be a lightweight * component. * * @param component The component to fetch the native container for. * * @return The native container object for this component. */ protected static Container getNativeContainer(Component component) { component = component.getParent(); while (true) { if (component == null) return null; if (! (component instanceof Container)) { component = component.getParent(); continue; } if (component.getPeer() instanceof LightweightPeer) { component = component.getParent(); continue; } return (Container) component; } } /** * Creates a new custom cursor object. * * @exception IndexOutOfBoundsException If the hotSpot values are outside * the bounds of the cursor. * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Cursor createCustomCursor(Image cursor, Point hotSpot, String name) { // Presumably the only reason this isn't abstract is for backwards // compatibility? FIXME? if (GraphicsEnvironment.isHeadless()) throw new HeadlessException("No custom cursor in an headless graphics " + "environment."); return null; } /** * Returns the supported cursor dimension which is closest to the * desired sizes. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) { if (GraphicsEnvironment.isHeadless()) throw new HeadlessException("No best cursor size in an headless " + "graphics environment."); return new Dimension (0,0); } /** * Returns the maximum number of colors the Toolkit supports in a custom * cursor palette. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public int getMaximumCursorColors() { return 0; } /** * Returns whether Toolkit supports this state for Frames. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. * * @since 1.4 */ public boolean isFrameStateSupported(int state) { return false; } /** * Returns the value of the property with the specified name, or the * default value if the property does not exist. * * @param key The name of the property to retrieve. * @param def The default value of the property. */ public static String getProperty(String key, String def) { return props.getProperty(key, def); } /** * Returns the event queue that is suitable for the calling context. * * <p>Despite the word “System” in the name of this * method, a toolkit may provide different event queues for each * applet. There is no guarantee that the same queue is shared * system-wide. * * <p>The implementation first checks whether a * SecurityManager has been installed. If so, its {@link * java.lang.SecurityManager#checkAwtEventQueueAccess()} method gets * called. The security manager will throw a SecurityException if it * does not grant the permission to access the event queue. * * <p>Next, the call is delegated to {@link * #getSystemEventQueueImpl()}. * * @return The event queue for this applet (or application). * * @throws SecurityException if a security manager has been * installed, and it does not grant the permission to access the * event queue. */ public final EventQueue getSystemEventQueue() { SecurityManager sm; sm = System.getSecurityManager(); if (sm != null) sm.checkAwtEventQueueAccess(); return getSystemEventQueueImpl(); } /** * Returns the event queue that is suitable for the calling context. * * <p>Despite the word “System” in the name of this * method, a toolkit may provide different event queues for each * applet. There is no guarantee that the same queue is shared * system-wide. * * <p>No security checks are performed, which is why this method * may only be called by Toolkits. * * @see #getSystemEventQueue() */ protected abstract EventQueue getSystemEventQueueImpl(); /** * @since 1.3 */ public abstract DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e); /** * @since 1.3 */ public DragGestureRecognizer createDragGestureRecognizer(Class recognizer, DragSource ds, Component comp, int actions, DragGestureListener l) { return null; } public final Object getDesktopProperty(String propertyName) { return desktopProperties.get(propertyName); } protected final void setDesktopProperty(String name, Object newValue) { Object oldValue = getDesktopProperty(name); desktopProperties.put(name, newValue); desktopPropsSupport.firePropertyChange(name, oldValue, newValue); } protected Object lazilyLoadDesktopProperty(String name) { // FIXME - what is this?? return null; } protected void initializeDesktopProperties() { // Overridden by toolkit implementation? } public void addPropertyChangeListener(String name, PropertyChangeListener pcl) { desktopPropsSupport.addPropertyChangeListener(name, pcl); } public void removePropertyChangeListener(String name, PropertyChangeListener pcl) { desktopPropsSupport.removePropertyChangeListener(name, pcl); } /** * @since 1.4 */ public PropertyChangeListener[] getPropertyChangeListeners() { return desktopPropsSupport.getPropertyChangeListeners(); } /** * @since 1.4 */ public PropertyChangeListener[] getPropertyChangeListeners(String name) { return desktopPropsSupport.getPropertyChangeListeners(name); } public void addAWTEventListener(AWTEventListener listener, long eventMask) { // SecurityManager s = System.getSecurityManager(); // if (s != null) // s.checkPermission(AWTPermission("listenToAllAWTEvents")); // FIXME } public void removeAWTEventListener(AWTEventListener listener) { // FIXME } /** * @since 1.4 */ public AWTEventListener[] getAWTEventListeners() { return null; } /** * @since 1.4 */ public AWTEventListener[] getAWTEventListeners(long mask) { return null; } /** * @since 1.3 */ public abstract Map mapInputMethodHighlight(InputMethodHighlight highlight);} // class Toolkit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -