📄 toolkit.java
字号:
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target); /** * Creates a peer object for the specified <code>Component</code>. The * peer returned by this method is not a native windowing system peer * with its own native window. Instead, this method allows the component * to draw on its parent window as a "lightweight" widget. * * @param target The <code>Component</code> to create the peer for. * * @return The peer for the specified <code>Component</code> object. */ protected LightweightPeer createComponent(Component target) { return new gnu.java.awt.peer.GLightweightPeer (target); } /** * Creates a peer object for the specified font name. * * @param name The font to create the peer for. * @param style The font style to create the peer for. * * @return The peer for the specified font name. * * @deprecated */ protected abstract FontPeer getFontPeer(String name, int style); /** * Copies the current system colors into the specified array. This is * the interface used by the <code>SystemColor</code> class. Although * this method fills in the array with some default colors a real Toolkit * should override this method and provide real system colors for the * native GUI platform. * * @param systemColors The array to copy the system colors into. * It must be at least 26 elements. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. * * @see java.awt.SystemColor */ protected void loadSystemColors(int systemColors[]) { systemColors[SystemColor.DESKTOP] = 0xFF005C5C; systemColors[SystemColor.ACTIVE_CAPTION] = 0xFF000080; systemColors[SystemColor.ACTIVE_CAPTION_TEXT] = 0xFFFFFFFF; systemColors[SystemColor.ACTIVE_CAPTION_BORDER] = 0xFFC0C0C0; systemColors[SystemColor.INACTIVE_CAPTION] = 0xFF808080; systemColors[SystemColor.INACTIVE_CAPTION_TEXT] = 0xFFC0C0C0; systemColors[SystemColor.INACTIVE_CAPTION_BORDER] = 0xFFC0C0C0; systemColors[SystemColor.WINDOW] = 0xFFFFFFFF; systemColors[SystemColor.WINDOW_BORDER] = 0xFF000000; systemColors[SystemColor.WINDOW_TEXT] = 0xFF000000; systemColors[SystemColor.MENU] = 0xFFC0C0C0; systemColors[SystemColor.MENU_TEXT] = 0xFF000000; systemColors[SystemColor.TEXT] = 0xFFC0C0C0; systemColors[SystemColor.TEXT_TEXT] = 0xFF000000; systemColors[SystemColor.TEXT_HIGHLIGHT] = 0xFF000090; systemColors[SystemColor.TEXT_HIGHLIGHT_TEXT] = 0xFFFFFFFF; systemColors[SystemColor.TEXT_INACTIVE_TEXT] = 0xFF808080; systemColors[SystemColor.CONTROL] = 0xFFC0C0C0; systemColors[SystemColor.CONTROL_TEXT] = 0xFF000000; systemColors[SystemColor.CONTROL_HIGHLIGHT] = 0xFFFFFFFF; systemColors[SystemColor.CONTROL_LT_HIGHLIGHT] = 0xFFE0E0E0; systemColors[SystemColor.CONTROL_SHADOW] = 0xFF808080; systemColors[SystemColor.CONTROL_DK_SHADOW] = 0xFF000000; systemColors[SystemColor.SCROLLBAR] = 0xFFE0E0E0; systemColors[SystemColor.INFO] = 0xFFE0E000; systemColors[SystemColor.INFO_TEXT] = 0xFF000000; } /** * @since 1.4 * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public void setDynamicLayout(boolean dynamic) { } /** * @since 1.4 * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected boolean isDynamicLayoutSet() { return false; } /** * @since 1.4 * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public boolean isDynamicLayoutActive() { return false; } /** * Returns the dimensions of the screen in pixels. * * @return The dimensions of the screen in pixels. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public abstract Dimension getScreenSize(); /** * Returns the screen resolution in dots per square inch. * * @return The screen resolution in dots per square inch. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public abstract int getScreenResolution(); /** * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. * * @since 1.4 */ public Insets getScreenInsets(GraphicsConfiguration gc) { return null; } /** * Returns the color model of the screen. * * @return The color model of the screen. * * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public abstract ColorModel getColorModel(); /** * Returns the names of the available fonts. * * @return The names of the available fonts. * * @deprecated */ public abstract String[] getFontList(); /** * Return the font metrics for the specified font * * @param name The name of the font to return metrics for. * * @return The requested font metrics. * * @deprecated */ public abstract FontMetrics getFontMetrics(Font name); /** * Flushes any buffered data to the screen so that it is in sync with * what the AWT system has drawn to it. */ public abstract void sync(); /** * Returns an instance of the default toolkit. The default toolkit is * the subclass of <code>Toolkit</code> specified in the system property * <code>awt.toolkit</code>, or <code>gnu.java.awt.peer.gtk.GtkToolkit</code> * if the property is not set. * * @return An instance of the system default toolkit. * * @throws AWTError If the toolkit cannot be loaded. */ public static Toolkit getDefaultToolkit() { if (toolkit != null) return toolkit; String toolkit_name = System.getProperty("awt.toolkit", default_toolkit_name); try { Class cls = Class.forName(toolkit_name); Object obj = cls.newInstance(); if (!(obj instanceof Toolkit)) throw new AWTError(toolkit_name + " is not a subclass of " + "java.awt.Toolkit"); toolkit = (Toolkit) obj; return toolkit; } catch (ThreadDeath death) { throw death; } catch (Throwable t) { AWTError e = new AWTError("Cannot load AWT toolkit: " + toolkit_name); throw (AWTError) e.initCause(t); } } /** * Returns an image from the specified file, which must be in a * recognized format. Supported formats vary from toolkit to toolkit. * * @return name The name of the file to read the image from. */ public abstract Image getImage(String name); /** * Returns an image from the specified URL, which must be in a * recognized format. Supported formats vary from toolkit to toolkit. * * @return url The URl to read the image from. */ public abstract Image getImage(URL url); public abstract Image createImage(String filename); public abstract Image createImage(URL url); /** * Readies an image to be rendered on the screen. The width and height * values can be set to the default sizes for the image by passing -1 * in those parameters. * * @param image The image to prepare for rendering. * @param width The width of the image. * @param height The height of the image. * @param observer The observer to receive events about the preparation * process. * * @return <code>true</code> if the image is already prepared for rendering, * <code>false</code> otherwise. */ public abstract boolean prepareImage(Image image, int width, int height, ImageObserver observer); /** * Checks the status of specified image as it is being readied for * rendering. * * @param image The image to prepare for rendering. * @param width The width of the image. * @param height The height of the image. * @param observer The observer to receive events about the preparation * process. * * @return A union of the bitmasks from * <code>java.awt.image.ImageObserver</code> that indicates the current * state of the imaging readying process. */ public abstract int checkImage(Image image, int width, int height, ImageObserver observer); /** * Creates an image using the specified <code>ImageProducer</code> * * @param producer The <code>ImageProducer</code> to create the image from. * * @return The created image. */ public abstract Image createImage(ImageProducer producer); /** * Creates an image from the specified byte array. The array must be in * a recognized format. Supported formats vary from toolkit to toolkit. * * @param data The raw image data. * * @return The created image. */ public Image createImage(byte[] data) { return createImage(data, 0, data.length); } /** * Creates an image from the specified portion of the byte array passed. * The array must be in a recognized format. Supported formats vary from * toolkit to toolkit. * * @param data The raw image data. * @param offset The offset into the data where the image data starts. * @param len The length of the image data. * * @return The created image. */ public abstract Image createImage(byte[] data, int offset, int len); /** * Returns a instance of <code>PrintJob</code> for the specified * arguments. * * @param frame The window initiating the print job. * @param title The print job title. * @param props The print job properties. * * @return The requested print job, or <code>null</code> if the job * was cancelled. * * @exception NullPointerException If frame is null, * or GraphicsEnvironment.isHeadless() returns true. * @exception SecurityException If this thread is not allowed to initiate * a print job request. */ public abstract PrintJob getPrintJob(Frame frame, String title, Properties props); /** * Returns a instance of <code>PrintJob</code> for the specified * arguments. * * @param frame The window initiating the print job. * @param title The print job title. * @param jobAttr A set of job attributes which will control the print job. * @param pageAttr A set of page attributes which will control the print job. * * @exception NullPointerException If frame is null, and either jobAttr is null * or jobAttr.getDialog() returns JobAttributes.DialogType.NATIVE. * @exception IllegalArgumentException If pageAttrspecifies differing cross * feed and feed resolutions, or when GraphicsEnvironment.isHeadless() returns * true. * @exception SecurityException If this thread is not allowed to initiate * a print job request. * * @since 1.3 */ public PrintJob getPrintJob(Frame frame, String title, JobAttributes jobAttr, PageAttributes pageAttr)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -