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

Prasanta Sadhukhan psadhukhan at openjdk.org
Fri Feb 3 17:15:50 UTC 2023


On Thu, 12 Jan 2023 06:14:32 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:
> 
>   Update spec wording

(1) This is an unique case..Normally, if there is no entry in `MetalLookAndFeel.initClassDefaults`, it means corresponding `Basic**UI class` will be used. However, in this case `MetalMenuBarUI `does not have entry in `MetalLookAndFeel.initClassDefaults` rather it is registered in `OceanTheme`, so it will not use `BasicMenuBarUI `even though `BasicMenuBarUI `is present
(2) If the Metal**UI class is to be used by a particular theme, then yes it seems it needs to be registered in that theme and not in MetalLookAndFeel.initClassDefaults

If any Metal**UI is registered in MetalLookAndFeel.initClassDefaults, then it means that Metal**UI will be used by all Metal Themes

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

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



More information about the client-libs-dev mailing list