Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Alexey Ivanov
On Fri, 20 Jun 2025 03:09:32 GMT, Prasanta Sadhukhan  
wrote:

> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is 
> not displayed in WindowsL&F when the test is run with NimbusL&F.
> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called 
> `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be 
> drawn. This is because the test after setting WIndows L&F of the menuitem 
> reverts back the Windows L&F to Nimbus L&F via 
> `UIManager.setLookAndFeel(save);` call in the test so when frame is made 
> visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
> 
> Fix is made to make sure the whole frame is updated to cater to L&F change 
> via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F 
> without reverting back to original L&F..

> One more thing I observed is "If we change the order of menu creation" then 
> the icons rendered are different. For e.g. if the order is
> 
> Shouldn't the icons for the L&Fs be same ?

That's the purpose of the test but it fails to test it.

You've just found another proof that multiple L&Fs can't be used concurrently. 
I've been talking about it since [the very start of this code 
review](https://github.com/openjdk/jdk/pull/25907#pullrequestreview-2953647827).

When you change L&F, all the `UIDefaults` of the old L&F are removed and values 
for the newly installed L&F are added.

If a component or its UI doesn't store a setting, such as color, font or icon, 
in its field, the setting is retrieved from `UIDefaults` — but the values are 
different now.

This is what happens in the current test without any changes. After Windows L&F 
is installed, the L&F is switched back to the whatever L&F was initially. As 
the result, there are no check marks and bullets in Windows L&F.

The test has to re-create its UI after testing for a L&F is complete. Such a 
scenario isn't supported by `PassFailJFrame` at the moment, see 
[JDK-8357455](https://bugs.openjdk.org/browse/JDK-8357455) and 
https://github.com/openjdk/jdk/pull/24439#discussion_r2100038079. There's no 
easy workaround.

The test doesn't receive events from `PassFailJFrame`, so the needs to be a 
custom UI, or the test should be run several times for different L&Fs.

-

PR Comment: https://git.openjdk.org/jdk/pull/25907#issuecomment-3035368348


Re: RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v30]

2025-07-04 Thread Alexey Ivanov
On Fri, 4 Jul 2025 13:17:43 GMT, Alexey Ivanov  wrote:

>> I guess the positioning with latest PR today should be ok
>> 
>> ![image](https://github.com/user-attachments/assets/f54247e8-6cbc-4b63-972f-90a155d5bbc1)
>
> No, it still doesn't match the style and margins that we see in Windows File 
> Explorer.
> 
> The latest fix doesn't change much, *the width of the menu hasn't changed*: 
> you just move the elements around trying to fit more into the same space, 
> which unavoidably reduces margins between elements.
> 
> The margin between the check mark / bullet and the icon should be larger, 
> that popup menu in Windows File Explorer has 35 pixel-margin between the 
> check mark and the icon, the latest version of the fix in this review has 
> only 7 pixels.
> 
> The width allocated for the popup menu has to increase where both check marks 
> / bullets and icons need to be rendered.

Compare the screenshots of File Explorer and Swing to [own 
comment](https://github.com/openjdk/jdk/pull/23324#issuecomment-2705406453).

There's so much “air” in File Explorer version of the popup menu. Yes, the 
location of the elements in Swing has changed since that time, but it can't 
match that in File Explorer.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2185371866


[jdk25] RFR: 8359889: java/awt/MenuItem/SetLabelTest.java inadvertently triggers clicks on items pinned to the taskbar

2025-07-04 Thread Manukumar V S
This is the backport of a test stabilisation fix done by @manukumarvs and 
approved by @aivanov-jdk.

Issue:
In Windows, java/awt/MenuItem/SetLabelTest.java inadvertently triggers clicks 
on items pinned to the taskbar. This may open some other UI item and may 
interfere further testing on that machine.

Fix:
Move the test UI to the centre of the screen by calling 
frame.setLocationRelativeTo(null).

-

Commit messages:
 - Backport b7fcd0b2351cee8d3d18abaf0bf5905d20c9d46c

Changes: https://git.openjdk.org/jdk/pull/26128/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26128&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8359889
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/26128.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26128/head:pull/26128

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


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Alexey Ivanov
On Fri, 4 Jul 2025 08:20:27 GMT, Abhishek Kumar  wrote:

>> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is 
>> not displayed in WindowsL&F when the test is run with NimbusL&F.
>> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called 
>> `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be 
>> drawn. This is because the test after setting WIndows L&F of the menuitem 
>> reverts back the Windows L&F to Nimbus L&F via 
>> `UIManager.setLookAndFeel(save);` call in the test so when frame is made 
>> visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
>> 
>> Fix is made to make sure the whole frame is updated to cater to L&F change 
>> via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F 
>> without reverting back to original L&F..
>
> test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 92:
> 
>> 90: JMenuBar menuBar = new JMenuBar();
>> 91: 
>> 92: menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel",
> 
> I tried to extend the test (with this PR changes included) for all installed 
> L&Fs and then create the menu for each L&F. 
> 
> UIManager.LookAndFeelInfo[] lafs = 
> UIManager.getInstalledLookAndFeels();
> for (final UIManager.LookAndFeelInfo lafInfo : lafs) {
> System.out.println("installed laf className : " + 
> lafInfo.getClassName());
> System.out.println("installed laf Name : " + lafInfo.getName());
> menuBar.add(createMenu(lafInfo.getClassName(), 
> lafInfo.getName()));
> }
> 
> Then the test failed with this exception 
> 
> java.lang.NullPointerException: Cannot invoke 
> "java.awt.Font.hashCode()" because "font" is null
>   at 
> java.desktop/sun.font.FontDesignMetrics$MetricsKey.init(FontDesignMetrics.java:213)
>   at 
> java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:282)
>   at 
> java.desktop/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1235)
> 
> Otherwise the RBMI and CBMI does contain the icon after the fix.

This is similar to the exception that I got 
[above](https://github.com/openjdk/jdk/pull/25907#issuecomment-3001288429). 
It's just a result of mixing several L&Fs at the same time.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2184908197


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Abhishek Kumar
On Fri, 20 Jun 2025 03:09:32 GMT, Prasanta Sadhukhan  
wrote:

> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is 
> not displayed in WindowsL&F when the test is run with NimbusL&F.
> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called 
> `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be 
> drawn. This is because the test after setting WIndows L&F of the menuitem 
> reverts back the Windows L&F to Nimbus L&F via 
> `UIManager.setLookAndFeel(save);` call in the test so when frame is made 
> visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
> 
> Fix is made to make sure the whole frame is updated to cater to L&F change 
> via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F 
> without reverting back to original L&F..

test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 1:

> 1: /*

Don't think it is required in the summary `The tester is asked to compare 
left-to-right and right-to-left menus and judge whether they are mirror images 
of each other.`, it is mentioned in instruction.

Not mandatory but still for consistency, you can move `This test checks if menu 
items lay out correctly when their` on the same line as `@summary`.

@summary This test checks if menu items lay out correctly when their

-

PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2184746651


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Abhishek Kumar
On Fri, 4 Jul 2025 09:54:54 GMT, Alexey Ivanov  wrote:

>> test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 92:
>> 
>>> 90: JMenuBar menuBar = new JMenuBar();
>>> 91: 
>>> 92: 
>>> menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel",
>> 
>> I tried to extend the test (with this PR changes included) for all installed 
>> L&Fs and then create the menu for each L&F. 
>> 
>> UIManager.LookAndFeelInfo[] lafs = 
>> UIManager.getInstalledLookAndFeels();
>> for (final UIManager.LookAndFeelInfo lafInfo : lafs) {
>> System.out.println("installed laf className : " + 
>> lafInfo.getClassName());
>> System.out.println("installed laf Name : " + lafInfo.getName());
>> menuBar.add(createMenu(lafInfo.getClassName(), 
>> lafInfo.getName()));
>> }
>> 
>> Then the test failed with this exception 
>> 
>> java.lang.NullPointerException: Cannot invoke 
>> "java.awt.Font.hashCode()" because "font" is null
>>  at 
>> java.desktop/sun.font.FontDesignMetrics$MetricsKey.init(FontDesignMetrics.java:213)
>>  at 
>> java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:282)
>>  at 
>> java.desktop/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1235)
>> 
>> Otherwise the RBMI and CBMI does contain the icon after the fix.
>
> This is similar to the exception that I got 
> [above](https://github.com/openjdk/jdk/pull/25907#issuecomment-3001288429). 
> It's just a result of mixing several L&Fs at the same time.

Yes but it was not supposed to come when 
`SwingUtilities.updateComponentTreeUI(frame)` is used to update all UI 
components.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2184932515


Re: RFR: 6955128: Spec for javax.swing.plaf.basic.BasicTextUI.getVisibleEditorRect contains inappropriate wording [v4]

2025-07-04 Thread Alexey Ivanov
On Fri, 4 Jul 2025 03:09:32 GMT, Prasanta Sadhukhan  
wrote:

>> BasicTextUI.getVisibleEditorRect wording is rephrased to remove the wording 
>> "Due to an unfortunate set of historical events this method is 
>> inappropriately named".
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Update javadoc

Changes requested by aivanov (Reviewer).

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java line 
1032:

> 1030: 
> 1031: /**
> 1032:  * Gets the allocation (i.e. the allocated size) for the root view.

> What I've been asking for is something like\
> "Gets the allocation (i.e. the allocated size) for the root view."

"Gets the allocation (i.e. the size) for the root view."

@prrace Does it sound better?

The [style 
guide](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#styleguide)
 for writing javadoc says:

> **Avoid Latin**
> 
> use "also known as" instead of "aka", use "that is" or "to be specific" 
> instead of "i.e.", use "for example" instead of "e.g.", and use "in other 
> words" or "namely" instead of "viz."

Taking the style guide into account, the text should change to

Suggestion:

 * Gets the allocation (that is the allocated size) for the root view.


I still don't like repeating _“allocated”_, does it clarify the meaning of just 
_“the size”_?

-

PR Review: https://git.openjdk.org/jdk/pull/25850#pullrequestreview-2986680868
PR Review Comment: https://git.openjdk.org/jdk/pull/25850#discussion_r2185065187


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Alexey Ivanov
On Fri, 4 Jul 2025 10:06:51 GMT, Abhishek Kumar  wrote:

> Yes but it was not supposed to come when 
> SwingUtilities.updateComponentTreeUI(frame) is used to update all UI 
> components.

Why not?

In fact, I expected that all the menu items would switch to the latest L&F 
after updating the component tree.

But it doesn't happen… because the menu bar isn't part of the component 
hierarchy (yet). If you move the call `frame.setJMenuBar(menuBar)` before each 
L&F menu is created, all the popup menus are displayed in Windows L&F, the 
latest installed L&F.

Either way, the test doesn't work correctly.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2184983021


Re: RFR: 8361283: [Accessibility, macOS, VoiceOver] VoiceOver announced Tab items of JTabbedPane as RadioButton on macOS [v2]

2025-07-04 Thread Artem Semenov
On Wed, 2 Jul 2025 15:37:30 GMT, Abhishek Kumar  wrote:

>> **Issue** : VO doesn't announce Tab items of a JTabbedPane as RadioButton 
>> which is wrong. 
>> 
>> **Analysis** : That is due to the role mapping of tab items as 
>> `NSAccessibilityRadioButtonRole` in `JavaAccessibilityUtilities.m` file. 
>> Since the accessibility role description is fetched in 
>> `accessibilityRoleDescription` API if `CommonComponentAccessiblity.m` file, 
>> the sub-role passed as a parameter is `nil`, returned value is RadioButton..
>> 
>> **Proposed Fix** : Fix is to get the correct accessibility role description 
>> from Appkit, we should pass `NSAccessibilityTabButtonSubrole` in the subrole 
>> parameter and that returns the accessibility role as `Tab` and is announced 
>> correctly by VO.
>> 
>> **Testing** : Manual test case has been added to verify the fix.
>
> Abhishek Kumar has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add test

src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/CommonComponentAccessibility.m
 line 865:

> 863: NSString *value = nil;
> 864: 
> 865: if ([[self javaRole] isEqualToString:@"pagetab"]) {

Мне кажется было бы лучше просто переопределить:

- (NSString *)accessibilityRoleDescription

В 
```src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TabButtonAccessibility.m```


It seems it would be better to simply override:

- (NSString *)accessibilityRoleDescription

in 
```src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/TabButtonAccessibility.m```

-

PR Review Comment: https://git.openjdk.org/jdk/pull/26096#discussion_r2185445536


Re: RFR: 8361216: Do not fork javac in J2DBench ant build

2025-07-04 Thread Magnus Ihse Bursie
On Thu, 3 Jul 2025 18:54:12 GMT, Phil Race  wrote:

> and don't get confused about the ant and make stuff. The JDK build does not 
> and is not expected to build j2dbench
> It is built directly by a developer when they need to run it.

I don't like how there is a separate build system like this. The fact that a 
resource does not need to be built everytime, but only when it is needed, is 
not a reason for it to not be built like everything else in the JDK source 
tree. If J2DBench is needed by developers, then the normal build system should 
be able to handle building that.

Now this discussion is spinning away a bit from the original PR, but I'd like 
to better understand what purpose the remaining demos serve, and if they are 
really located in the right place.

>From what I can see we have these demos:

* java2d/J2DBench
* jfc/CodePointIM
* jfc/FileChooserDemo
* jfc/Font2DTest
* jfc/J2Ddemo
* jfc/Metalworks
* jfc/Notepad
* jfc/SampleTree
* jfc/Stylepad
* jfc/SwingSet2
* jfc/TableExample
* jfc/TransparentRuler

All the jfc demos are built by the normal JDK build system. But some of them 
also have additional build.xml files, and J2DBench also have a separate 
Makefile.

-

PR Comment: https://git.openjdk.org/jdk/pull/26077#issuecomment-3036052948


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Alexey Ivanov
On Fri, 4 Jul 2025 12:07:26 GMT, Prasanta Sadhukhan  
wrote:

> > The test has to re-create its UI after testing for a L&F is complete. Such 
> > a scenario isn't supported by `PassFailJFrame` at the moment, see 
> > [JDK-8357455](https://bugs.openjdk.org/browse/JDK-8357455) and [#24439 
> > (comment)](https://github.com/openjdk/jdk/pull/24439#discussion_r2100038079).
> >  There's no easy workaround.
> > The test doesn't receive events from `PassFailJFrame`, so the needs to be a 
> > custom UI, or the test should be run several times for different L&Fs.
> 
> So do you propose to test like what is being done in 
> https://github.com/openjdk/jdk/pull/24439/files passing L&F argument to jtreg 
> tag?

Yes, this is the simplest way.

Another option is to have a driver class. For example, if no arguments are 
passed to `main`, the test gets the list of all available or specific L&F as 
hard-coded now, then runs the same test with a parameter that specifies a L&F 
to test. The driver then captures both standard output and error streams of the 
process and throws an exception if the exit code from the subprocess isn't 0.

The first approach is simpler as it uses jtreg to run the test with different 
parameters.

-

PR Comment: https://git.openjdk.org/jdk/pull/25907#issuecomment-3036103833


Re: RFR: 8158801: [TEST_BUG] Mixing tests fail because of focus workaround trick [v3]

2025-07-04 Thread Khalid Boulanouare
> Many Mixing tests failed because the work around click lands on the 
> minimizing area in the window control and causes the tests to fail.
> 
> This fix changes the width of base frames which allows most of tests to pass.

Khalid Boulanouare has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains five additional 
commits since the last revision:

 - Merge branch 'openjdk:master' into jdk-8158801
 - Changes protected fields to static
 - Problem list files for Mac OS only
 - Removes passed tests from problem list
 - Changes Frame width to 300, uses protected constants for all base tests 
frame sizes

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/25971/files
  - new: https://git.openjdk.org/jdk/pull/25971/files/fa864b2f..9c7b4c70

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25971&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25971&range=01-02

  Stats: 14219 lines in 615 files changed: 8042 ins; 3791 del; 2386 mod
  Patch: https://git.openjdk.org/jdk/pull/25971.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25971/head:pull/25971

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


Re: RFR: 8348760: RadioButton is not shown if JRadioButtonMenuItem is rendered with ImageIcon in WindowsLookAndFeel [v30]

2025-07-04 Thread Alexey Ivanov
On Fri, 4 Jul 2025 03:23:54 GMT, Prasanta Sadhukhan  
wrote:

>> After your latest fix, the accelerator doesn't get painted over the menu 
>> text, but the positioning is still way off.
>> 
>> With the added column for the icon the menu width has to increase but it 
>> hasn't. Instead, the width remains the same, and you squeeze both check mark 
>> / bullet and icon to the same allocated space.
>> 
>> The position of the check mark must not change in the new layout. In old 
>> rendering code, the was 29-pixel margin between the left edge and first 
>> pixel of the check mark (at 200% scale), but now it's reduced to 23 pixels 
>> only.
>> 
>> There was 24-pixel margin between an icon and text, but now it's only 6 
>> pixels.
>> 
>> The margin between menu text and accelerator is reduced from 12 pixels to 4.
>> 
>> The menu looks too crowded, squished. You have to properly add *a new column 
>> for the icon* with margins around it whenever a popup menu has a 
>> JCheckBoxMenuItem or JRadioButtonMenuItem with an icon.
>
> I guess the positioning with latest PR today should be ok
> 
> ![image](https://github.com/user-attachments/assets/f54247e8-6cbc-4b63-972f-90a155d5bbc1)

No, it still match the style and margins that we see in Windows File Explorer.

The latest fix doesn't change much, *the width of the menu hasn't changed*: you 
just move the elements around trying to fit more into the same space, which 
unavoidably reduces margins between elements.

The margin between the check mark / bullet and the icon should be larger, that 
popup menu in Windows File Explorer has 35 pixel-margin between the check mark 
and the icon, the latest version of the fix in this review has only 7 pixels.

The width allocated for the popup menu has to increase where both check marks / 
bullets and icons need to be rendered.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/23324#discussion_r2185359330


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Abhishek Kumar
On Fri, 20 Jun 2025 03:09:32 GMT, Prasanta Sadhukhan  
wrote:

> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is 
> not displayed in WindowsL&F when the test is run with NimbusL&F.
> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called 
> `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be 
> drawn. This is because the test after setting WIndows L&F of the menuitem 
> reverts back the Windows L&F to Nimbus L&F via 
> `UIManager.setLookAndFeel(save);` call in the test so when frame is made 
> visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
> 
> Fix is made to make sure the whole frame is updated to cater to L&F change 
> via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F 
> without reverting back to original L&F..

test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 92:

> 90: JMenuBar menuBar = new JMenuBar();
> 91: 
> 92: menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel",

I tried to extend the test (with this PR changes included) for all installed 
L&Fs and then create the menu for each L&F. 

UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();
for (final UIManager.LookAndFeelInfo lafInfo : lafs) {
System.out.println("installed laf className : " + 
lafInfo.getClassName());
System.out.println("installed laf Name : " + lafInfo.getName());
menuBar.add(createMenu(lafInfo.getClassName(), lafInfo.getName()));
}

Then the test failed with this exception 

java.lang.NullPointerException: Cannot invoke 
"java.awt.Font.hashCode()" because "font" is null
at 
java.desktop/sun.font.FontDesignMetrics$MetricsKey.init(FontDesignMetrics.java:213)
at 
java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:282)
at 
java.desktop/sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1235)

Otherwise the RBMI and CBMI does contain the icon after the fix.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2184710678


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Abhishek Kumar
On Fri, 20 Jun 2025 03:09:32 GMT, Prasanta Sadhukhan  
wrote:

> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is 
> not displayed in WindowsL&F when the test is run with NimbusL&F.
> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called 
> `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be 
> drawn. This is because the test after setting WIndows L&F of the menuitem 
> reverts back the Windows L&F to Nimbus L&F via 
> `UIManager.setLookAndFeel(save);` call in the test so when frame is made 
> visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
> 
> Fix is made to make sure the whole frame is updated to cater to L&F change 
> via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F 
> without reverting back to original L&F..

One more thing I observed is "If we change the order of menu creation" then the 
icons rendered are different.
For e.g. if the order is

menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel",
"Metal"));

menuBar.add(createMenu("com.sun.java.swing.plaf.windows.WindowsLookAndFeel",
"Windows"));
menuBar.add(createMenu("com.sun.java.swing.plaf.motif.MotifLookAndFeel",
"Motif"));

then the icons are 
![Windows_Second_Pos](https://github.com/user-attachments/assets/81efec22-b3b2-48e2-a31b-f095c8ec4c3f)

and when Windows L&F is at last pos then rendered icons are
![Windows_Last_Pos](https://github.com/user-attachments/assets/6b13bfb8-c319-4344-afd7-26584f3a2056)

Shouldn't the icons for the L&Fs be same ?

-

PR Comment: https://git.openjdk.org/jdk/pull/25907#issuecomment-3034978507


Re: RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus Lo

2025-07-04 Thread Prasanta Sadhukhan
On Fri, 20 Jun 2025 03:09:32 GMT, Prasanta Sadhukhan  
wrote:

> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is 
> not displayed in WindowsL&F when the test is run with NimbusL&F.
> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called 
> `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be 
> drawn. This is because the test after setting WIndows L&F of the menuitem 
> reverts back the Windows L&F to Nimbus L&F via 
> `UIManager.setLookAndFeel(save);` call in the test so when frame is made 
> visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
> 
> Fix is made to make sure the whole frame is updated to cater to L&F change 
> via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F 
> without reverting back to original L&F..

> The test has to re-create its UI after testing for a L&F is complete. Such a 
> scenario isn't supported by `PassFailJFrame` at the moment, see 
> [JDK-8357455](https://bugs.openjdk.org/browse/JDK-8357455) and [#24439 
> (comment)](https://github.com/openjdk/jdk/pull/24439#discussion_r2100038079). 
> There's no easy workaround.
> 
> The test doesn't receive events from `PassFailJFrame`, so the needs to be a 
> custom UI, or the test should be run several times for different L&Fs.

So do you propose to test like what is being done in 
https://github.com/openjdk/jdk/pull/24439/files passing L&F argument to jtreg 
tag?

-

PR Comment: https://git.openjdk.org/jdk/pull/25907#issuecomment-3035935556


Re: RFR: 8361283: [Accessibility, macOS, VoiceOver] VoiceOver announced Tab items of JTabbedPane as RadioButton on macOS [v2]

2025-07-04 Thread Andrey Turbanov
On Wed, 2 Jul 2025 15:37:30 GMT, Abhishek Kumar  wrote:

>> **Issue** : VO doesn't announce Tab items of a JTabbedPane as RadioButton 
>> which is wrong. 
>> 
>> **Analysis** : That is due to the role mapping of tab items as 
>> `NSAccessibilityRadioButtonRole` in `JavaAccessibilityUtilities.m` file. 
>> Since the accessibility role description is fetched in 
>> `accessibilityRoleDescription` API if `CommonComponentAccessiblity.m` file, 
>> the sub-role passed as a parameter is `nil`, returned value is RadioButton..
>> 
>> **Proposed Fix** : Fix is to get the correct accessibility role description 
>> from Appkit, we should pass `NSAccessibilityTabButtonSubrole` in the subrole 
>> parameter and that returns the accessibility role as `Tab` and is announced 
>> correctly by VO.
>> 
>> **Testing** : Manual test case has been added to verify the fix.
>
> Abhishek Kumar has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add test

test/jdk/javax/accessibility/JTabbedPane/AccessibleTabbedPaneRoleTest.java line 
74:

> 72: tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
> 73: tabPane.setTabPlacement(JTabbedPane.TOP);
> 74: for( int i = 0; i < NUM_TABS; ++i) {

Suggestion:

for (int i = 0; i < NUM_TABS; ++i) {

-

PR Review Comment: https://git.openjdk.org/jdk/pull/26096#discussion_r2185219013