<Swing Dev> <AWT Dev> Review Request JDK-6421058: When calls JSpinner.setEditor() the font in a JSpinner become is a bold

Prem Balakrishnan prem.balakrishnan at oracle.com
Mon May 9 05:52:21 UTC 2016


Hi Sergey,
Thankyou for the Review.

http://cr.openjdk.java.net/~pkbalakr/6421058/webrev.01/ 

Updated patch as per review comments.
[mainFrame.dispose(), by mistake I missed to uncomment which was commented during testing.]

Regards,
Prem

-----Original Message-----
From: Sergey Bylokhov 
Sent: Saturday, May 07, 2016 2:12 AM
To: Ajit Ghaisas; Prem Balakrishnan; Semyon Sadetsky; Rajeev Chamyal; Ambarish Rapte; swing-dev at openjdk.java.net
Subject: Re: <AWT Dev> Review Request JDK-6421058: When calls JSpinner.setEditor() the font in a JSpinner become is a bold

Hi, Prem.
The null check before instance of is not necessary: editor != null.
Why the code is commented in the test "//mainFrame.dispose()"?

> Please review fix for JDK9,
>
> *Bug:*https://bugs.openjdk.java.net/browse/JDK-6421058
>
> *Webrev:*http://cr.openjdk.java.net/~pkbalakr/6421058/webrev.00/
>
>
>
> *Analysis:*
>
> *Expected Behavior: *
> 1. The font of the text field is changed to the font of JSpinner if 
> the font of text field was NOT set by the user.
> 2. The font of the text field is NOT changed to the font of JSpinner 
> if the font of text field was set by the user.
>
>
> Default Font for JSpinner is set to "MetalTheme.CONTROL_TEXT_FONT", 
> which is by default BOLD.
> MetalLookAndFeel derives it's color palette and fonts from MetalTheme.
>
>
>
> As per Java docs:
> DefaultMetalTheme uses bold fonts for many controls. To make all 
> controls (with the exception of the internal frame title bars and 
> client decorated frame title bars) use plain fonts you can do either 
> of the
> following:
>
>     Set the system property swing.boldMetal to false. For example, 
> java -Dswing.boldMetal=false MyApp.
>     Set the defaults property swing.boldMetal to Boolean.FALSE. For
> example: UIManager.put("swing.boldMetal", Boolean.FALSE);
>
>
>
> As per analysis, Expected Behavior[2] holds good, where as Expected 
> Behavior[1] fails to set the default font(i.e., Spinner's font) to 
> TextField when TextField font is not set explicitly.
>
> *Issue:*
> Here the issue is other way, i.e., The Font in JSpinner is NOT BOLD, 
> before calling JSpinner.setEditor().
>
> Because TextField Font is NOT SET to JSpinner Font during Initialization.
>
>
>
> *Fix:*
>
> TextField Font is SET  to JSpinner Font during Initialization.
>
>
>
> *Regression Test:*
>
> Jtreg and JCK tests PASSED without causing any regression with the 
> suggested fix, across all platforms (Win/Linux/Mac).
>
> * *
>
>
>
>
>
> Regards,
> Prem
>
>
>
>
>


--
Best regards, Sergey.



More information about the swing-dev mailing list