EVALUATION
Name: ca25432 Date: 12/13/2001
This feature has been added for Tiger release
======================================================================
The new look, aka ocean, will be on by default.
To get the old look either do -Dswing.metalTheme=steel, or programmaticaly do
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
UIManager.setLookAndFeel(new MetalLookAndFeel());
Contrary to my comments this resulted in a handful of API changes:
Old look will be available with the system property swing.metalTheme=steel
Revise spec of javax.swing.AbstractButton#getDisabledIcon from:
/**
* Returns the icon used by the button when it's disabled.
* If no disabled icon has been set, the button constructs
* one from the default icon.
* <!-- PENDING(jeff): the disabled icon really should be created
* (if necessary) by the L&F.-->
*
* @return the <code>disabledIcon</code> property
* @see #getPressedIcon
* @see #setDisabledIcon
*/
public Icon getDisabledIcon();
to:
/**
* Returns the icon used by the button when it's disabled.
* If no disabled icon has been set this will forward the call to
* the ui to construct an appropriate disabled Icon.
* <p>
* Some look and feels might not render the disabled Icon, in which
* case they will ignore this.
*
* @return the <code>disabledIcon</code> property
* @see #getPressedIcon
* @see #setDisabledIcon
* @see javax.swing.plaf.ButtonUI#getDisabledIcon
*/
public Icon getDisabledIcon();
Add the following new method to javax.swing.plaf.ButtonUI:
/**
* Returns the icon to display when the developer has not specified
* a disabled icon.
* <p>
* Some look and feels might not render the disabled Icon, in which
* case they will ignore this.
*
* @param button AbstractButton requesting the Icon
* @return Disabled icon, or null.
* @see javax.swing.AbstractButton#setIcon
* @see javax.swing.AbstractButton#setDisabledIcon
* @throws NullPointerException if <code>button</code> is null
* @since 1.5
*/
public Icon getDisabledIcon(AbstractButton button);
Add the following two overriden methods to javax.swing.plaf.metal.MetalCombBoxUI:
/**
* If necessary paints the currently selected item.
*
* @param g Graphics to paint to
* @param bounds Region to paint current value to
* @param hasFocus whether or not the JComboBox has focus
* @throws NullPointerException if any of the arguments are null.
* @since 1.5
*/
public void paintCurrentValue(Graphics g, Rectangle bounds,
boolean hasFocus);
/**
* If necessary paints the background of the currently selected item.
*
* @param g Graphics to paint to
* @param bounds Region to paint background to
* @param hasFocus whether or not the JComboBox has focus
* @throws NullPointerException if any of the arguments are null.
* @since 1.5
*/
public void paintCurrentValueBackground(Graphics g, Rectangle bounds,
boolean hasFocus);
Add the following two overriden methods to javax.swing.plaf.metal.MetalButtonUI:
/**
* If necessary paints the background of the component, then
* invokes <code>paint</code>.
*
* @param g Graphics to paint to
* @param c JComponent painting on
* @throws NullPointerException if <code>g</code> or <code>c</code> is
* null
* @see javax.swing.plaf.ComponentUI#update
* @see javax.swing.plaf.ComponentUI#paint
* @since 1.5
*/
public void update(Graphics g, JComponent c);
/**
* Returns the icon to display when the button is disabled.
*
* @param button AbstractButton requesting the Icon
* @return Disabled icon, or null.
* @see javax.swing.AbstractButton#setIcon
* @see javax.swing.AbstractButton#setDisabledIcon
* @throws NullPointerException if <code>button</code> is null
* @since 1.5
*/
public Icon getDisabledIcon(AbstractButton button);
Create the class javax.swing.plaf.metal.MetalMenuBarUI:
/**
* Metal implementation of <code>MenuBarUI</code>. This class is responsible
* for providing the metal look and feel for <code>JMenuBar</code>s.
*
* @see javax.swing.plaf.MenuBarUI
* @since 1.5
*/
public class MetalMenuBarUI extends BasicMenuBarUI {
/**
* Creates the <code>ComponentUI</code> implementation for the passed
* in component.
*
* @param x JComponent to create the ComponentUI implementation for
* @return ComponentUI implementation for <code>x</code>
* @throws NullPointerException if <code>x</code> is null
*/
public static ComponentUI createUI(JComponent x);
/**
* Configures the specified component appropriate for the metal look and
* feel.
*
* @param c the component where this UI delegate is being installed
* @throws NullPointerException if <code>c</code> is null.
*/
public void installUI(JComponent c);
/**
* Reverses configuration which was done on the specified component during
* <code>installUI</code>.
*
* @param c the component where this UI delegate is being installed
* @throws NullPointerException if <code>c</code> is null.
*/
public void uninstallUI(JComponent c);
/**
* If necessary paints the background of the component, then
* invokes <code>paint</code>.
*
* @param g Graphics to paint to
* @param c JComponent painting on
* @throws NullPointerException if <code>g</code> or <code>c</code> is
* null
* @see javax.swing.plaf.ComponentUI#update
* @see javax.swing.plaf.ComponentUI#paint
* @since 1.5
*/
public void update(Graphics g, JComponent c);
}
Add the following overriden method to javax.swing.plaf.metal.MetalToolBarUI:
/**
* If necessary paints the background of the component, then invokes
* <code>paint</code>.
*
* @param g Graphics to paint to
* @param c JComponent painting on
* @throws NullPointerException if <code>g</code> or <code>c</code> is
* null
* @see javax.swing.plaf.ComponentUI#update
* @see javax.swing.plaf.ComponentUI#paint
* @since 1.5
*/
public void update(Graphics g, JComponent c);
Add the following overriden methods to javax.swing.plaf.metal.MetalToggleButtonUI:
/**
* If necessary paints the background of the component, then invokes
* <code>paint</code>.
*
* @param g Graphics to paint to
* @param c JComponent painting on
* @throws NullPointerException if <code>g</code> or <code>c</code> is
* null
* @see javax.swing.plaf.ComponentUI#update
* @see javax.swing.plaf.ComponentUI#paint
* @since 1.5
*/
public void update(Graphics g, JComponent c);
/**
* Paints the appropriate icon of the button <code>b</code> in the
* space <code>iconRect</code>.
*
* @param g Graphics to paint to
* @param b Button to render for
* @param iconRect space to render in
* @throws NullPointerException if any of the arguments are null.
* @since 1.5
*/
protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect);
/**
* Returns the icon to display when the button is disabled.
*
* @param button AbstractButton requesting the Icon
* @return Disabled icon, or null.
* @see javax.swing.AbstractButton#setIcon
* @see javax.swing.AbstractButton#setDisabledIcon
* @throws NullPointerException if <code>button</code> is null
* @since 1.5
*/
public Icon getDisabledIcon(AbstractButton button);
###@###.### 2003-08-08
|