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 179484 - setBackground() on JFrame does nothing
Summary: setBackground() on JFrame does nothing
Status: RESOLVED DUPLICATE of bug 36710
Alias: None
Product: ide
Classification: Unclassified
Component: UI (show other bugs)
Version: 8.2
Hardware: PC Windows 10
: P2 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-13 21:43 UTC by _ tboudreau
Modified: 2017-06-27 10:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Can not change JFrame background color at design time (146.09 KB, image/jpeg)
2017-06-24 06:29 UTC, vinh_truong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2010-01-13 21:43:14 UTC
We should probably hide the "background" property on JFrames/JDialogs/JWindows the same way we hide properties like "toolkit" - on any of these, what you actually want is getContentPane().setBackground().
Comment 1 Jan Stola 2010-02-25 07:06:25 UTC

*** This bug has been marked as a duplicate of bug 36710 ***
Comment 2 vinh_truong 2017-06-24 06:29:56 UTC
Created attachment 164619 [details]
Can not change JFrame background color at design time
Comment 3 Tomas Pavek 2017-06-27 10:04:27 UTC
This is still a duplicate of issue 36710.

If you want to set the background color of the content pane of the JFrame, you must do it in the code via getContentPane().setBackground(...).

If you want to see the background in the GUI builder then e.g. add JPanel over the whole JFrame area in the designer (possibly use BorderLayout). Or design a JPanel separately and add it to a JFrame programmatically.

*** This bug has been marked as a duplicate of bug 36710 ***
Comment 4 Tomas Pavek 2017-06-27 10:06:34 UTC
I.e. set the background on a JPanel that spans the whole JFrame content area.