This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 105612 - Fonts constructed with numeric rather than symbolic values
Summary: Fonts constructed with numeric rather than symbolic values
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Property Editors (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-04 16:49 UTC by dmiller
Modified: 2012-09-27 09:28 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


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.