2362N/A * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Provides the metal look and feel implementation of <code>RootPaneUI</code>. 0N/A * <code>MetalRootPaneUI</code> provides support for the 0N/A * <code>windowDecorationStyle</code> property of <code>JRootPane</code>. 0N/A * <code>MetalRootPaneUI</code> does this by way of installing a custom 0N/A * <code>LayoutManager</code>, a private <code>Component</code> to render 0N/A * the appropriate widgets, and a private <code>Border</code>. The 0N/A * <code>LayoutManager</code> is always installed, regardless of the value of 0N/A * the <code>windowDecorationStyle</code> property, but the 0N/A * the <code>windowDecorationStyle</code> is other than 0N/A * <code>JRootPane.NONE</code>. 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * @author Terry Kellerman 0N/A * Keys to lookup borders in defaults table. 0N/A null,
"RootPane.frameBorder",
"RootPane.plainDialogBorder",
0N/A "RootPane.informationDialogBorder",
0N/A "RootPane.errorDialogBorder",
"RootPane.colorChooserDialogBorder",
0N/A "RootPane.fileChooserDialogBorder",
"RootPane.questionDialogBorder",
0N/A "RootPane.warningDialogBorder" 0N/A * The amount of space (in pixels) that the cursor is changed on. 0N/A * Region from edges that dragging is active from. 0N/A * Window the <code>JRootPane</code> is in. 0N/A * <code>JComponent</code> providing window decorations. This will be 0N/A * null if not providing window decorations. 0N/A * <code>MouseInputListener</code> that is added to the parent 0N/A * <code>Window</code> the <code>JRootPane</code> is contained in. 0N/A * The <code>LayoutManager</code> that is set on the 0N/A * <code>JRootPane</code>. 0N/A * <code>LayoutManager</code> of the <code>JRootPane</code> before we 0N/A * <code>JRootPane</code> providing the look and feel for. 0N/A * <code>Cursor</code> used to track the cursor set by the user. 0N/A * This is initially <code>Cursor.DEFAULT_CURSOR</code>. 0N/A * Creates a UI for a <code>JRootPane</code>. 0N/A * @param c the JRootPane the RootPaneUI will be created for 0N/A * @return the RootPaneUI implementation for the passed in JRootPane 0N/A * Invokes supers implementation of <code>installUI</code> to install 0N/A * the necessary state onto the passed in <code>JRootPane</code> 0N/A * to render the metal look and feel implementation of 0N/A * <code>RootPaneUI</code>. If 0N/A * the <code>windowDecorationStyle</code> property of the 0N/A * <code>JRootPane</code> is other than <code>JRootPane.NONE</code>, 0N/A * this will add a custom <code>Component</code> to render the widgets to 0N/A * <code>JRootPane</code>, as well as installing a custom 0N/A * <code>Border</code> and <code>LayoutManager</code> on the 0N/A * <code>JRootPane</code>. 0N/A * @param c the JRootPane to install state onto 0N/A * Invokes supers implementation to uninstall any of its state. This will 0N/A * also reset the <code>LayoutManager</code> of the <code>JRootPane</code>. 0N/A * If a <code>Component</code> has been added to the <code>JRootPane</code> 0N/A * to render the window decoration style, this method will remove it. 0N/A * Similarly, this will revert the Border and LayoutManager of the 0N/A * <code>JRootPane</code> to what it was before <code>installUI</code> 0N/A * @param c the JRootPane to uninstall state from 0N/A * Installs the appropriate <code>Border</code> onto the 0N/A * <code>JRootPane</code>. 0N/A * Removes any border that may have been installed. 0N/A * Installs the necessary Listeners on the parent <code>Window</code>, 0N/A * This takes the parent so that cleanup can be done from 0N/A * <code>removeNotify</code>, at which point the parent hasn't been 0N/A * @param parent The parent of the JRootPane 0N/A * Uninstalls the necessary Listeners on the <code>Window</code> the 0N/A * Listeners were last installed on. 0N/A * Installs the appropriate LayoutManager on the <code>JRootPane</code> 0N/A * to render the window decorations. 0N/A * Uninstalls the previously installed <code>LayoutManager</code>. 0N/A * Installs the necessary state onto the JRootPane to render client 0N/A * decorations. This is ONLY invoked if the <code>JRootPane</code> 0N/A * has a decoration style other than <code>JRootPane.NONE</code>. 0N/A * Uninstalls any state that <code>installClientDecorations</code> has 0N/A * NOTE: This may be called if you haven't installed client decorations 0N/A * yet (ie before <code>installClientDecorations</code> has been invoked). 0N/A // the installClientDecorations is always called after this method 0N/A // Reset the cursor, as we may have changed it to a resize cursor 0N/A * Returns the <code>JComponent</code> to render the window decoration 0N/A * Returns a <code>MouseListener</code> that will be added to the 0N/A * <code>Window</code> containing the <code>JRootPane</code>. 0N/A * Returns a <code>LayoutManager</code> that will be set on the 0N/A * <code>JRootPane</code>. 0N/A * Sets the window title pane -- the JComponent used to provide a plaf a 0N/A * way to override the native operating system's window title pane with 0N/A * one whose look and feel are controlled by the plaf. The plaf creates 0N/A * and sets this value; the default is null, implying a native operating 0N/A * system window title pane. 0N/A * @param content the <code>JComponent</code> to use for the window title pane. 0N/A * Returns the <code>JComponent</code> rendering the title pane. If this 0N/A * returns null, it implies there is no need to render window decorations. 0N/A * @return the current window title pane, or null 0N/A * @see #setTitlePane 0N/A * Returns the <code>JRootPane</code> we're providing the look and 0N/A * Invoked when a property changes. <code>MetalRootPaneUI</code> is 0N/A * primarily interested in events originating from the 0N/A * <code>JRootPane</code> it has been installed on identifying the 0N/A * property <code>windowDecorationStyle</code>. If the 0N/A * <code>windowDecorationStyle</code> has changed to a value other 0N/A * than <code>JRootPane.NONE</code>, this will add a <code>Component</code> 0N/A * to the <code>JRootPane</code> to render the window decorations, as well 0N/A * as installing a <code>Border</code> on the <code>JRootPane</code>. 0N/A * On the other hand, if the <code>windowDecorationStyle</code> has 0N/A * changed to <code>JRootPane.NONE</code>, this will remove the 0N/A * <code>Component</code> that has been added to the <code>JRootPane</code> 0N/A * as well resetting the Border to what it was before 0N/A * <code>installUI</code> was invoked. 0N/A * @param e A PropertyChangeEvent object describing the event source 0N/A * and the property that has changed. 0N/A // This is potentially more than needs to be done, 0N/A // simpler. MetalTitlePane also assumes it will be recreated if 0N/A // the decoration style changes. 0N/A * A custom layout manager that is responsible for the layout of 0N/A * layeredPane, glassPane, menuBar and titlePane, if one has been 0N/A // NOTE: Ideally this would extends JRootPane.RootLayout, but that 0N/A // would force this to be non-static. 0N/A * Returns the amount of space the layout would like to have. 0N/A * @param the Container for which this layout manager is being used 0N/A * @return a Dimension object containing the layout's preferred size 0N/A * Returns the minimum amount of space the layout needs. 0N/A * @param the Container for which this layout manager is being used 0N/A * @return a Dimension object containing the layout's minimum size 0N/A * Returns the maximum amount of space the layout can use. 0N/A * @param the Container for which this layout manager is being used 0N/A * @return a Dimension object containing the layout's maximum size 0N/A // Only overflows if 3 real non-MAX_VALUE heights, sum to > MAX_VALUE 0N/A // Only will happen if sums to more than 2 billion units. Not likely. 0N/A // Similar overflow comment as above 0N/A * Instructs the layout manager to perform the layout for the specified 0N/A * @param the Container for which this layout manager is being used 0N/A // Note: This is laying out the children in the layeredPane, 0N/A // technically, these are not our children. 0N/A * Maps from positions to cursor type. Refer to calculateCorner and 0N/A * calculatePosition for details of this. 0N/A * the Window. It sets the cursor directly on the Window when then 0N/A * mouse moves over a hot spot. 0N/A * Set to true if the drag operation is moving the window. 0N/A * Used to determine the corner the resize is occuring from. 0N/A * X location the mouse went down on for a drag operation. 0N/A * Y location the mouse went down on for a drag operation. 0N/A * Width of the window when the drag started. 0N/A * Height of the window when the drag started. 0N/A // Some Window systems validate as you resize, others won't, 0N/A // thus the check for validity before repainting. 0N/A // Update the cursor 0N/A // layout is active. 0N/A * Returns the corner that contains the point <code>x</code>, 0N/A * <code>y</code>, or -1 if the position doesn't match a corner. 0N/A * Returns the Cursor to render for the specified corner. This returns 0N/A * 0 if the corner doesn't map to a valid Cursor 0N/A * Returns an integer indicating the position of <code>spot</code> 0N/A * in <code>width</code>. The return value will be: 0N/A * 0 if < BORDER_DRAG_THICKNESS 0N/A * 1 if < CORNER_DRAG_WIDTH 0N/A * 2 if >= CORNER_DRAG_WIDTH && < width - BORDER_DRAG_THICKNESS 0N/A * 3 if >= width - CORNER_DRAG_WIDTH 0N/A * 4 if >= width - BORDER_DRAG_THICKNESS