RFR: 6513512: MetalLookAndFeel.initClassDefaults does not install an entry for MetalMenuBarUI [v5]

Alexey Ivanov aivanov at openjdk.org
Tue Feb 7 20:39:15 UTC 2023


On Mon, 6 Feb 2023 09:24:23 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Spec for [MetalLookAndFeel](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java#L247)
>> says:
>> "...MetalLookAndFeel registers an entry for each of the classes
>> in the package javax.swing.plaf.metal that are named MetalXXXUI.
>> The string XXX is one of Swing's uiClassIDs. For the uiClassIDs
>> that do not have a class in metal, the corresponding class in
>> javax.swing.plaf.basic is used. For example, metal does not
>> have a class named "MetalColorChooserUI", as such,
>> javax.swing.plaf.basic.BasicColorChooserUI is used".
>> 
>> There is class MetalMenuBarUI, but the method populates given defaults table with the value
>> "javax.swing.plaf.basic.BasicMenuBarUI".
>> 
>> Added entry for MetalMenuBarUI..
>> CI tests including JCK tests are ok.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add MetalMenuBarUI in MetalL&F

Marked as reviewed by aivanov (Reviewer).

Is there really only Ocean theme? If I start SwingSet2, there are a handful of Metal themes under **Theme** menu.

If I change the theme, the colours of the menu bar also change.

What happens if I use a different theme instead of the default Ocean?

It's possible by passing `-Dswing.metalTheme=steel`. The menu bar is still styled.

So it looks all Metal themes use `MetalMenuBarUI`. As such, moving the registration of `MenuBarUI` class id from `OceanTheme` to `MetalLookAndFeel` makes sense. Especially, taking into account that javadoc for `MetalMenuBarUI` states, it “is responsible for the metal look and feel of `JMenuBar`s.”

-------------

PR: https://git.openjdk.org/jdk/pull/11646



More information about the client-libs-dev mailing list