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 130413 - Background color of a JFrame
Summary: Background color of a JFrame
Status: VERIFIED DUPLICATE of bug 36710
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-18 15:34 UTC by Petr Dvorak
Modified: 2008-03-18 19:56 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2008-03-18 15:34:52 UTC
Product Version: NetBeans IDE Dev (Build 200803170003)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Linux version 2.6.24-12-generic running on i386; UTF-8; en_US (nb)

Create a new project and insert a new JFrame. Go to properties window and set background property of JFrame form to red.
If you run the application now, the window just flashes red and then becomes gray again.

The reason is that a code generated in "initComponents" function is:

1) setBackground(new java.awt.Color(57, 214, 18));

But 99% of programmers would probably expect the behavior of code:

2) getContentPane().setBackground(new java.awt.Color(57, 214, 18));

Simply, the JFrame is covered with some other container (content pane), so if you want to set up the background color
for the JFrame, you need to do it with writing a code manually, not with a visual designer. IMHO, the behavior of the
second code would be much more intuitive and visual designer would be probably more frequently used for this purpose.

Proposal: Visual designer should generate the second code, the first one can be written manually if needed, as it is
less frequently used.

As the change in the property window is not in fact reflected in the real application, I leave it as a defect (the code
is not generated properly - with respect to the info above), but I assume it will be changed to enhancement by someone...
Comment 1 Jan Stola 2008-03-18 16:03:03 UTC

*** This issue has been marked as a duplicate of 36710 ***
Comment 2 Petr Dvorak 2008-03-18 19:56:48 UTC
Yes, it is a duplicate of that issue.

Verified