Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Wed, 18 Aug 2021 04:59:36 GMT, Prasanta Sadhukhan wrote: > Have you checked if button does not have any text? Yes, i did. Neither my code nor native focus painter is affected by it. - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Tue, 17 Aug 2021 06:04:39 GMT, Alexander Zuev 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
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Mon, 16 Aug 2021 23:46:18 GMT, Sergey Bylokhov 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. 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. - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Mon, 16 Aug 2021 23:39:05 GMT, Alexander Zuev wrote: >> What about the color property? > >> What about the color property? > > That would be unnecessary, whoever does painting does not just assumes that > the color is set to his preferred choice, everywhere in the code color is set > up before doing any painting and i do not see anywhere that old color being > preserved. 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. - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Mon, 16 Aug 2021 20:53:56 GMT, Sergey Bylokhov wrote: > What about the color property? That would be unnecessary, whoever does painting does not just assumes that the color is set to his preferred choice, everywhere in the code color is set up before doing any painting and i do not see anywhere that old color being preserved. - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Mon, 16 Aug 2021 19:45:11 GMT, Alexander Zuev wrote: >> src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java line 340: >> >>> 338: Color ringColor = UIManager.getColor("Focus.color"); >>> 339: g.setColor(ringColor); >>> 340: g.drawRoundRect(5, 3, b.getWidth() - 10, b.getHeight() - 7, >>> 15, 15); >> >> Don't you need to restore the properties of Graphics2D? > >> Don't you need to restore the properties of Graphics2D? > > I might as well. What about the color property? - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Mon, 16 Aug 2021 18:49:31 GMT, Sergey Bylokhov wrote: > Don't you need to restore the properties of Graphics2D? I might as well. - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Fri, 13 Aug 2021 19:17:13 GMT, Alexander Zuev wrote: >> Initial implementation and a test case. >> >> The problem is that Aqua LaF shows the focused component with the glow on >> the border, hence when the border is not painted the foxus is not displayed. >> The idea is to paint the glowing border on the focused component anyways. > > Alexander Zuev has updated the pull request incrementally with one additional > commit since the last revision: > > Remove getLookAndFeelDefaults() call That looks great. src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java line 340: > 338: Color ringColor = UIManager.getColor("Focus.color"); > 339: g.setColor(ringColor); > 340: g.drawRoundRect(5, 3, b.getWidth() - 10, b.getHeight() - 7, 15, > 15); Don't you need to restore the properties of Graphics2D? - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Mon, 16 Aug 2021 02:15:55 GMT, Sergey Bylokhov wrote: > Can you please create of blend of two images, one for common focused > button(with border) and another one w/o. Just to check that the border is > drawn in the similar location and using similar "shape". Here is the overlap of two images - with and without borders painted, the without borders painted has 80% opacity so borders look faint. I do not think that the focus ring will always be pixel perfect match with the natively painted - but they are close enough that switching border painting on and off i can not tell difference visually and the new focus ring is always contained within the button shape so it will not disrupt anything beyond it. ![focus1b](https://user-images.githubusercontent.com/69642324/129612749-21283e4f-b97e-4aa0-aee1-451b9e60f151.png) - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
On Fri, 13 Aug 2021 19:17:13 GMT, Alexander Zuev wrote: >> Initial implementation and a test case. >> >> The problem is that Aqua LaF shows the focused component with the glow on >> the border, hence when the border is not painted the foxus is not displayed. >> The idea is to paint the glowing border on the focused component anyways. > > Alexander Zuev has updated the pull request incrementally with one additional > commit since the last revision: > > Remove getLookAndFeelDefaults() call Can you please create of blend of two images, one for common focused button(with border) and another one w/o. Just to check that the border is drawn in the similar location and using similar "shape". - PR: https://git.openjdk.java.net/jdk/pull/5082
Re: RFR: 8269951: [macos] Focus not painted in JButton when setBorderPainted(false) is invoked [v4]
> Initial implementation and a test case. > > The problem is that Aqua LaF shows the focused component with the glow on the > border, hence when the border is not painted the foxus is not displayed. The > idea is to paint the glowing border on the focused component anyways. Alexander Zuev has updated the pull request incrementally with one additional commit since the last revision: Remove getLookAndFeelDefaults() call - Changes: - all: https://git.openjdk.java.net/jdk/pull/5082/files - new: https://git.openjdk.java.net/jdk/pull/5082/files/fefcd37d..df34ab0b Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5082&range=03 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5082&range=02-03 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/5082.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/5082/head:pull/5082 PR: https://git.openjdk.java.net/jdk/pull/5082