639 lines · 24.1 KB · Java
RawDownload
     * @param y the new <i>y</i>-coordinate relative to the parent component     * @param width the new <code>width</code> of this embedded frame     * @param height the new <code>height</code> of this embedded frame     * @see java.awt.Component#setBounds     * @see #setLocationPrivate     * @see #getLocationPrivate     * @see #getBoundsPrivate     * @since 1.5     */    protected void setBoundsPrivate(int x, int y, int width, int height) {        final FramePeer peer = (FramePeer)getPeer();        if (peer != null) {            peer.setBoundsPrivate(x, y, width, height);        }    }     /**     * Gets the bounds of this embedded frame as a rectangle specifying the     * width, height and location relative to the native parent component.     * <p>     * setLocation() and setBounds() for EmbeddedFrame really don't move it     * within the native parent. These methods always put embedded frame to     * (0, 0) for backward compatibility. To allow getting location and size     * of embedded frames getLocationPrivate() and getBoundsPrivate() were     * introduced, and they work just the same way as getLocation() and getBounds()     * for ususal, non-embedded components.     * </p>     * <p>     * Using usual get/setLocation() and get/setBounds() together with new     * get/setLocationPrivate() and get/setBoundsPrivate() is not recommended.     * For example, calling getBoundsPrivate() after setLocation() works fine,     * but getBounds() after setBoundsPrivate() may return unpredictable value.     * </p>     * @return a rectangle indicating this embedded frame's bounds     * @see java.awt.Component#getBounds     * @see #setLocationPrivate     * @see #getLocationPrivate     * @see #setBoundsPrivate     * @since 1.6     */    protected Rectangle getBoundsPrivate() {        final FramePeer peer = (FramePeer)getPeer();        if (peer != null) {            return peer.getBoundsPrivate();        }        else {            return getBounds();        }    }     public void toFront() {}    public void toBack() {}     public abstract void registerAccelerator(AWTKeyStroke stroke);    public abstract void unregisterAccelerator(AWTKeyStroke stroke);     /**     * Checks if the component is in an EmbeddedFrame. If so,     * returns the applet found in the hierarchy or null if     * not found.     * @return the parent applet or {@ null}     * @since 1.6     */    public static Applet getAppletIfAncestorOf(Component comp) {        Container parent = comp.getParent();        Applet applet = null;        while (parent != null && !(parent instanceof EmbeddedFrame)) {            if (parent instanceof Applet) {                applet = (Applet)parent;            }            parent = parent.getParent();        }        return parent == null ? null : applet;    }     /**     * This method should be overriden in subclasses. It is     * called when window this frame is within should be blocked     * by some modal dialog.     */    public void notifyModalBlocked(Dialog blocker, boolean blocked) {    }     private static class NullEmbeddedFramePeer        extends NullComponentPeer implements FramePeer {        public void setTitle(String title) {}        public void setIconImage(Image im) {}        public void updateIconImages() {}        public void setMenuBar(MenuBar mb) {}        public void setResizable(boolean resizeable) {}        public void setState(int state) {}        public int getState() { return Frame.NORMAL; }        public void setMaximizedBounds(Rectangle b) {}        public void toFront() {}        public void toBack() {}        public void updateFocusableWindowState() {}        public void updateAlwaysOnTop() {}        public void setAlwaysOnTop(boolean alwaysOnTop) {}        public Component getGlobalHeavyweightFocusOwner() { return null; }        public void setBoundsPrivate(int x, int y, int width, int height) {            setBounds(x, y, width, height, SET_BOUNDS);        }        public Rectangle getBoundsPrivate() {            return getBounds();        }        public void setModalBlocked(Dialog blocker, boolean blocked) {}         /**         * @see java.awt.peer.ContainerPeer#restack         */        public void restack() {            throw new UnsupportedOperationException();        }         /**         * @see java.awt.peer.ContainerPeer#isRestackSupported         */        public boolean isRestackSupported() {            return false;        }        public boolean requestWindowFocus() {            return false;        }        public void updateMinimumSize() {        }         public void setOpacity(float opacity) {        }         public void setOpaque(boolean isOpaque) {        }         public void updateWindow() {        }         public void repositionSecurityWarning() {        }     }} // class EmbeddedFrame

Lines 501–639 of 639. Previous lines