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

Summary: setBackground() on JFrame does nothing
Product: ide Reporter: _ tboudreau <tboudreau>
Component: UIAssignee: issues@ide <issues>
Status: RESOLVED DUPLICATE    
Severity: normal CC: vinh_truong
Priority: P2    
Version: 8.2   
Hardware: PC   
OS: Windows 10   
Issue Type: DEFECT Exception Reporter:
Attachments: Can not change JFrame background color at design time

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.