Bug 105612 - Fonts constructed with numeric rather than symbolic values
Fonts constructed with numeric rather than symbolic values
Status: NEW
Product: platform
Classification: Unclassified
Component: Property Editors
5.x
All All
: P3 (vote)
: 6.x
Assigned To: Stanislav Aubrecht
issues@platform
sp_review_61
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-04 16:49 UTC by dmiller
Modified: 2012-09-27 09:28 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dmiller 2007-06-04 16:49:46 UTC
Currently setting the font for a component generates code like this:

    Label1.setFont(new java.awt.Font("SansSerif", 0, 12));
    Label2.setFont(new java.awt.Font("SansSerif", 1, 12));
    Label3.setFont(new java.awt.Font("SansSerif", 2, 12));
    Label4.setFont(new java.awt.Font("SansSerif", 3, 12));

The second argument is the style (plain, bold, italic, bold italic) for which
there are constants in Font. To be correct about it, the generated code should
use the constants, not their numeric values.

    Label1.setFont(new java.awt.Font("SansSerif", java.awt.Font.PLAIN, 12));
    Label2.setFont(new java.awt.Font("SansSerif", java.awt.Font.BOLD, 12));
    Label3.setFont(new java.awt.Font("SansSerif", java.awt.Font.ITALIC, 12));
    Label4.setFont(new java.awt.Font("SansSerif",
java.awt.Font.BOLD|java.awt.Font.ITALIC, 12));
Comment 1 Tomas Pavek 2007-06-08 14:52:37 UTC
I agree, would make the code more readable.
Comment 2 Jan Stola 2008-06-02 14:41:30 UTC
FontEditor lies outside GUI builder. Reassigning to its owner - core/property editors.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo