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

Summary: Fonts constructed with numeric rather than symbolic values
Product: platform Reporter: dmiller <dmiller>
Component: Property EditorsAssignee: Stanislav Aubrecht <saubrecht>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

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.