<Swing Dev> RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Wed Aug 18 05:02:23 UTC 2021


On Tue, 17 Aug 2021 06:04:39 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

>> You can trace the usage of graphics.getColor() for example in AquaMenuItemUI/WindowsMenuUI/BevelBorder/etc to check that the old color property is usually saved and then restored.
>
>> You can trace the usage of graphics.getColor() for example in AquaMenuItemUI/WindowsMenuUI/BevelBorder/etc to check that the old color property is usually saved and then restored.
> 
> A few lines above paintFocus() is called there is a section that sets color to something different in case of opaque button and that does not affect the next step - text painting - since text painter will grab text color and set the graphics draw color to it. However in the interest of moving forward i will ad saving the color - after al it is not a performance critical task.

Have you checked if button does not have any text? It might affect the drawRoundRect values which are hardcoded now...In MetalButtonUI#paintFocus, it seems they cater to Button focus ring with and without text by taking care of setBounds(). Do we need to do something similar here?

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

PR: https://git.openjdk.java.net/jdk/pull/5082


More information about the swing-dev mailing list