frame.java

来自「This is a resource based on j2me embedde」· Java 代码 · 共 504 行 · 第 1/2 页

JAVA
504
字号
     * <p>     * <em>Note: This operation is subject to     * <a href="#restrictions">restriction</a>     * in Personal Basis Profile.</em>     *     * @param gc the <code>GraphicsConfiguration</code>     * of the target screen device. If <code>gc</code>     * is <code>null</code>, the system default     * <code>GraphicsConfiguration</code> is assumed.     * @exception IllegalArgumentException if     * <code>gc</code> is not from a screen device.     * @since     1.3     */    public Frame(GraphicsConfiguration gc) {        this("", gc);    }    /**     * Constructs a new, initially invisible <code>Frame</code> object     * with the specified title and a     * <code>GraphicsConfiguration</code>.     * <p>     * <em>Note: This operation is subject to     * <a href="#restrictions">restriction</a>     * in Personal Basis Profile.</em>     *     * @param title the title to be displayed in the frame's border.     *              A <code>null</code> value     *              is treated as an empty string, "".     * @param gc the <code>GraphicsConfiguration</code>     * of the target screen device.  If <code>gc</code> is     * <code>null</code>, the system default     * <code>GraphicsConfiguration</code> is assumed.     * @exception IllegalArgumentException if <code>gc</code>     * is not from a screen device.     * @see java.awt.Component#setSize     * @see java.awt.Component#setVisible     * @see java.awt.GraphicsConfiguration#getBounds     */    public Frame(String title, GraphicsConfiguration gc) {        super(gc);        this.title = title;        // 6206316        setFocusTraversalPolicy(KeyboardFocusManager.                                getCurrentKeyboardFocusManager().                                getDefaultFocusTraversalPolicy()                                );    }    /**     * Constructs a new, initially invisible <code>Frame</code> object     * with the specified title.     * <p>     * <em>Note: This operation is subject to     * <a href="#restrictions">restriction</a>     * in Personal Basis Profile.</em>     *     * @param title the title to be displayed in the frame's border.     *              A <code>null</code> value     *              is treated as an empty string, "".     * @exception IllegalArgumentException if gc is not from     * a screen device.     * @see java.awt.Component#setSize     * @see java.awt.Component#setVisible     * @see java.awt.GraphicsConfiguration#getBounds     */    public Frame(String title) {        this(title, (GraphicsConfiguration) null);    }    /**     * Gets the title of the frame.  The title is displayed in the     * frame's border.     * @return    the title of this frame, or an empty string ("")     *                if this frame doesn't have a title.     * @see       java.awt.Frame#setTitle     */    public String getTitle() {        return title;    }    /**     * Sets the title for this frame to the specified string.     * <p>     * <em>Note: This operation is subject to     * <a href="#restrictions">restriction</a>     * in Personal Basis Profile.</em>     *     * @param    title    the title to be displayed in the frame's border     * @param title the title to be displayed in the frame's border.     *              A <code>null</code> value     *              is treated as an empty string, "".     * @see      java.awt.Frame#getTitle     */    public synchronized void setTitle(String title) {        this.title = (title == null) ? "" : title;            }    /**     * Gets the image to be displayed in the minimized icon     * for this frame.     * @return    the icon image for this frame, or <code>null</code>     *                    if this frame doesn't have an icon image.     * @see       java.awt.Frame#setIconImage     */    public Image getIconImage() {        return icon;    }    /**     * Sets the image to displayed in the minimized icon for this frame.     * Not all platforms support the concept of minimizing a window.     * @param     image the icon image to be displayed.     *            If this parameter is <code>null</code> then the     *            icon image is set to the default image, which may vary     *            with platform.     * @see       java.awt.Frame#getIconImage     */    public synchronized void setIconImage(Image image) {        icon = image;    }    /**     * Indicates whether this frame is resizable by the user.     * By default, all frames are initially resizable.     * @return    <code>true</code> if the user can resize this frame;     *                        <code>false</code> otherwise.     * @see       java.awt.Frame#setResizable     */    public boolean isResizable() {        return this.resizable; // 6248021    }    /**     * Sets whether this frame is resizable by the user.     * <p>     * <em>Note: This operation is subject to     * <a href="#restrictions">restriction</a>     * in Personal Basis Profile.</em>     *     * @param    resizable   <code>true</code> if this frame is resizable;     *                       <code>false</code> otherwise.     * @see      java.awt.Frame#isResizable     */    public void setResizable(boolean resizable) {        this.resizable = resizable; // 6248021    }    /**     * Disables or enables decorations for this frame.     * This method can only be called while the frame is not displayable.     * @param  undecorated <code>true</code> if no frame decorations are     *         to be enabled;     *         <code>false</code> if frame decorations are to be enabled.     * @throws <code>IllegalComponentStateException</code> if the frame     *         is displayable.     * @see    #isUndecorated     * @see    Component#isDisplayable     * @see    javax.swing.JFrame#setDefaultLookAndFeelDecorated(boolean)     * @since 1.4     */    public void setUndecorated(boolean undecorated) {        /* Make sure we don't run in the middle of peer creation.*/        synchronized (getTreeLock()) {            if (isDisplayable()) {                throw new IllegalComponentStateException("The frame is displayable.");            }            /* Basis frame is undecorated always - fail silently */            // 6261403 - no longer allowed to fail silently - need to return            // the correct value even if we don't support it            this.undecorated = undecorated;        }    }    /**     * Indicates whether this frame is undecorated.     * By default, all frames are initially decorated.     * @return    <code>true</code> if frame is undecorated;     *                        <code>false</code> otherwise.     * @see       java.awt.Frame#setUndecorated(boolean)     * @since 1.4     */    public boolean isUndecorated() {        return undecorated;    }    /**     * Sets the state of this frame.     * <p>     * <em>Note: This operation is subject to     * <a href="#restrictions">restriction</a>     * in Personal Basis Profile.</em>     *     * @param  state <code>Frame.ICONIFIED</code> if this frame is in     *           iconic state; <code>Frame.NORMAL</code> if this frame is     *           in normal state.     * @see      java.awt.Frame#getState     */    public synchronized void setState(int state) {        getToolkit().isFrameStateSupported(state);    }    /**     * Gets the state of this frame.     * @return   <code>Frame.ICONIFIED</code> if frame in iconic state;     *           <code>Frame.NORMAL</code> if frame is in normal state.     * @see      java.awt.Frame#setState     */    public synchronized int getState() {        return state;    }    /**     * Returns the parameter String of this Frame.     */    protected String paramString() {        return null;    }    /**     * Frame Serialized Data Version.     *     * @serial     */    private int frameSerializedDataVersion = 1;    /**     * Writes default serializable fields to stream.  Writes     * a list of serializable ItemListener(s) as optional data.     * The non-serializable ItemListner(s) are detected and     * no attempt is made to serialize them.     *     * @serialData Null terminated sequence of 0 or more pairs.     *             The pair consists of a String and Object.     *             The String indicates the type of object and     *             is one of the following :     *             itemListenerK indicating and ItemListener object.     *     * @see java.awt.Component.itemListenerK     */    private void writeObject(ObjectOutputStream s)        throws IOException {}    /**     * Read the ObjectInputStream and if it isnt null     * add a listener to receive item events fired     * by the Frame.     * Unrecognised keys or values will be Ignored.     * @see removeActionListener()     * @see addActionListener()     */    private void readObject(ObjectInputStream s)        throws ClassNotFoundException, IOException {}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?