On Fri, 21 Mar 2025 16:22:40 GMT, Alexey Ivanov <aiva...@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:\
![The test button is rendered with Cambria font as 
expected](https://github.com/user-attachments/assets/3655c1a4-eb1c-4110-9f21-d3f5a84d297b)
 ![The test button gets rendered with Dialog font while 
disabled](https://github.com/user-attachments/assets/d3ed72cd-3834-4271-8bec-d9f7a3384873)
 ![The test button remains rendered with the Dialog font after it's enabled 
again](https://github.com/user-attachments/assets/7fa7d26e-1888-4bb6-9ead-086a0ea7a24b)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24152#discussion_r2008016974

Reply via email to