EVALUATION
Name: db100478 Date: 09/08/2000
Committing to merlin release
======================================================================
This feature has been reduced to providing metal decorations for top level frames. Here is the spec:
Add the following to javax.swing.JDialg
/**
* Provides a hint as to whether or not newly created <code>JDialog</code>s
* should have their Window decorations (such as borders, widgets to
* close the window, title...) provided by the current look
* and feel. If <code>defaultLookAndFeelDecorated</code> is true,
* the current <code>LookAndFeel</code> supports providing window
* decorations, and the current window manager supports undecorated
* windows, then newly created <code>JDialog</code>s will have their
* Window decorations provided by the current <code>LookAndFeel</code>.
* Otherwise, newly created <code>JDialog</code>s will have their
* Window decorations provided by the current window manager.
* <p>
* You can get the same effect on a single JDialog by doing the following:
* <pre>
* JDialog dialog = new JDialog();
* dialog.setUndecorated(true);
* dialog.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
* </pre>
*
* @param defaultLookAndFeelDecorated A hint as to whether or not current
* look and feel should provide window decorations
* @see javax.swing.LookAndFeel.getSupportsWindowDecorations
* @since 1.4
*/
public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated);
/**
* Returns true if newly created <code>JDialog</code>s should have their
* Window decorations provided by the current look and feel. This is only
* a hint, as certain look and feels may not support this feature.
*
* @return true if look and feel should provide Window decorations.
* @since 1.4
*/
public static boolean isDefaultLookAndFeelDecorated();
Add the following to javax.swing.JFrame:
/**
* Provides a hint as to whether or not newly created <code>JFrame</code>s
* should have their Window decorations (such as borders, widgets to
* close the window, title...) provided by the current look
* and feel. If <code>defaultLookAndFeelDecorated</code> is true,
* the current <code>LookAndFeel</code> supports providing window
* decorations, and the current window manager supports undecorated
* windows, then newly created <code>JFrame</code>s will have their
* Window decorations provided by the current <code>LookAndFeel</code>.
* Otherwise, newly created <code>JFrame</code>s will have their
* Window decorations provided by the current window manager.
* <p>
* You can get the same effect on a single JFrame by doing the following:
* <pre>
* JFrame frame = new JFrame();
* frame.setUndecorated(true);
* frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
* </pre>
*
* @param defaultLookAndFeelDecorated A hint as to whether or not current
* look and feel should provide window decorations
* @see javax.swing.LookAndFeel.getSupportsWindowDecorations
* @since 1.4
*/
public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated);
/**
* Returns true if newly created <code>JFrame</code>s should have their
* Window decorations provided by the current look and feel. This is only
* a hint, as certain look and feels may not support this feature.
*
* @return true if look and feel should provide Window decorations.
* @since 1.4
*/
public static boolean isDefaultLookAndFeelDecorated();
Add the following to javax.swing.JRootPane:
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should not provide any sort of
* Window decorations.
*
* @since 1.4
*/
public static final int NONE;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Frame.
*
* @since 1.4
*/
public static final int FRAME;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog.
*
* @since 1.4
*/
public static final int PLAIN_DIALOG;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display an informational message.
*
* @since 1.4
*/
public static final int INFORMATION_DIALOG;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display an error message.
*
* @since 1.4
*/
public static final int ERROR_DIALOG;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display a <code>JColorChooser</code>.
*
* @since 1.4
*/
public static final int COLOR_CHOOSER_DIALOG;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display a <code>JFileChooser</code>.
*
* @since 1.4
*/
public static final int FILE_CHOOSER_DIALOG;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to present a question to the user.
*
* @since 1.4
*/
public static final int QUESTION_DIALOG;
/**
* Constant used for the windowDecorationStyle property. Indicates that
* the <code>JRootPane</code> should provide decorations appropriate for
* a Dialog used to display a warning message.
*
* @since 1.4
*/
public static final int WARNING_DIALOG;
/**
* Sets the type of Window decorations (such as borders, widgets for
* closing a Window, title ...) the <code>JRootPane</code> should
* provide. The default is to provide no Window decorations,
* <code>NONE</code>.
* <p>
* This is only a hint, and some look and feels may not support
* this.
* <p>
* This will throw an IllegalArgumentException
* <p>
* This is a bound property.
*
* @param style Constant identifying Window decorations to provide
* @see JDialog#setDefaultLookAndFeelDecorated
* @see JFrame#setDefaultLookAndFeelDecorated
* @see LookAndFeel#getSupportsWindowDecorations
* @throws IllegalArgumentException if <code>style</code> is
* not one of: <code>NONE</code>, <code>FRAME</code>,
* <code>PLAIN_DIALOG</code>, <code>INFORMATION_DIALOG</code>,
* <code>ERROR_DIALOG</code>, <code>COLOR_CHOOSER_DIALOG</code>,
* <code>FILE_CHOOSER_DIALOG</code>, <code>QUESTION_DIALOG</code> or
* <code>WARNING_DIALOG</code>.
* @since 1.4
* @beaninfo
* bound: true
* enum: NONE JRootPane.NONE
* FRAME JRootPane.FRAME
* PLAIN_DIALOG JRootPane.PLAIN_DIALOG
* INFORMATION_DIALOG JRootPane.INFORMATION_DIALOG
* ERROR_DIALOG JRootPane.ERROR_DIALOG
* COLOR_CHOOSER_DIALOG JRootPane.COLOR_CHOOSER_DIALOG
* FILE_CHOOSER_DIALOG JRootPane.FILE_CHOOSER_DIALOG
* QUESTION_DIALOG JRootPane.QUESTION_DIALOG
* WARNING_DIALOG JRootPane.WARNING_DIALOG
* expert: true
* attribute: visualUpdate true
* description: Identifies the type of Window decorations to provide
*/
public void setWindowDecorationStyle(int style);
/**
* Returns a constant identifying the type of Window decorations the
* <code>JRootPane</code> is providing.
*
* @return One of code>NONE</code>, <code>FRAME</code>,
* <code>PLAIN_DIALOG</code>, <code>INFORMATION_DIALOG</code>,
* <code>ERROR_DIALOG</code>, <code>COLOR_CHOOSER_DIALOG</code>,
* <code>FILE_CHOOSER_DIALOG</code>, <code>QUESTION_DIALOG</code> or
* <code>WARNING_DIALOG</code>.
* @see #setWindowDecorationStyle
* @since 1.4
*/
public int getWindowDecorationStyle();
Add the following to javax.swing.LookAndFeel:
/**
* Returns true if the <code>LookAndFeel</code> returned
* <code>RootPaneUI</code> instances support providing Window decorations
* in a <code>JRootPane</code>.
* <p>
* The default implementation returns false, sublclasses that support
* Window decorations should override this and return true.
*
* @return True if the RootPaneUI instances created support client side
* decorations
* @see JDialog#setDefaultLookAndFeelDecorated
* @see JFrame#setDefaultLookAndFeelDecorated
* @see JRootPane#setWindowDecorationStyle
* @since 1.4
*/
public boolean getSupportsWindowDecorations();
New class javax.swing.plaf.metal.MetalRootPaneUI:
/**
* Provides the metal look and feel implementation of <code>RootPaneUI</code>.
* <p>
* <code>MetalRootPaneUI</code> provides support for the
* <code>windowDecorationStyle</code> property of <code>JRootPane</code>.
* <code>MetalRootPaneUI</code> does this by way of installing a custom
* <code>LayoutManager</code>, a private <code>Component</code> to render
* the appropriate widgets, and a private <code>Border</code>. The
* <code>LayoutManager</code> is always installed, regardless of the value of
* the <code>windowDecorationStyle</code> property, but the
* <code>Border</code> and <code>Component</code> are only installed/added if
* the <code>windowDecorationStyle</code> is other than
* <code>JRootPane.NONE</code>.
*
* @author Terry Kellerman
* @since 1.4
*/
public class MetalRootPaneUI extends BasicRootPaneUI {
/**
* Creates a UI for a <code>JRootPane</code>.
*
* @param c the JRootPane the RootPaneUI will be created for
* @return the RootPaneUI implementation for the passed in JRootPane
*/
public static ComponentUI createUI(JComponent c);
/**
* Invokes supers implementation of <code>installUI</code> to install
* the necessary state onto the passed in <code>JRootPane</code>
* to render the metal look and feel implementation of
* <code>RootPaneUI</code>. This will also install a new
* <code>LayoutManager</code> on the <code>JRootPane</code>. If
* the <code>windowDecorationStyle</code> property of the
* <code>JRootPane</code> is other than <code>JRootPane.NONE</code>,
* this will add a custom <code>Component</code> to render the widgets to
* <code>JRootPane</code>, as well as installing a custom
* <code>Border</code> on the <code>JRootPane</code>.
*
* @param c the JRootPane to install state onto
*/
public void installUI(JComponent c);
/**
* Invokes supers implementation to uninstall any of its state. This will
* also reset the <code>LayoutManager</code> of the <code>JRootPane</code>.
* If a <code>Component</code> has been added to the <code>JRootPane</code>
* to render the window decoration style, this method will remove it.
* Similarly, this will revert the Border and LayoutManager of the
* <code>JRootPane</code> to what it was before <code>installUI</code>
* was invoked.
*
* @param c the JRootPane to uninstall state from
*/
public void uninstallUI(JComponent c);
/**
* Invoked when a property changes. <code>MetalRootPaneUI</code> is
* primarily interested in events originating from the
* <code>JRootPane</code> it has been installed on identifying the
* property <code>windowDecorationStyle</code>. If the
* <code>windowDecorationStyle</code> has changed to a value other
* than <code>JRootPane.NONE</code>, this will add a <code>Component</code>
* to the <code>JRootPane</code> to render the window decorations, as well
* as installing a <code>Border</code> on the <code>JRootPane</code>.
* On the other hand, if the <code>windowDecorationStyle</code> has
* changed to <code>JRootPane.NONE</code>, this will remove the
* <code>Component</code> that has been added to the <code>JRootPane</code>
* as well resetting the Border to what it was before
* <code>installUI</code> was invoked.
*
* @param e A PropertyChangeEvent object describing the event source
* and the property that has changed.
*/
public void propertyChange(PropertyChangeEvent e);
}
scott.violet@eng 2000-11-17
|