RFR: 6734168: BasicButtonUI uses wrong FontMetrics to Layout JButtons text
Alexey Ivanov
aivanov at openjdk.org
Fri Mar 21 17:29:28 UTC 2025
On Fri, 21 Mar 2025 16:22:40 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> If there were a way to re-enable the button again, it would render with `Font.DIALOG` instead of the custom font that I set when the button was created.
Indeed, the button font is changed permanently.
If I modify the test code:
System.out.println("Before: " + getFont());
super.paintComponent(imgGraphics);
System.out.println("After: " + getFont());
The output looks this way:
Before: java.awt.Font[family=Cambria,name=Cambria,style=plain,size=20]
After: java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]
If I add another button to re-enable the first button, the frame looks like this:\
  
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24152#discussion_r2008016974
More information about the client-libs-dev
mailing list