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 130325 - Background color of a JLabel
Summary: Background color of a JLabel
Status: RESOLVED INVALID
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: goyalritesh21
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-17 18:52 UTC by Petr Dvorak
Modified: 2017-06-28 17:37 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Background color for a label is not modified (106.88 KB, image/png)
2008-03-17 19:09 UTC, Petr Dvorak
Details
Background color is set to black but it does not show any change in the frame. (118.52 KB, image/png)
2017-06-28 17:11 UTC, goyalritesh21
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Dvorak 2008-03-17 18:52:54 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)

[Maybe I did not get something - if so, resolve this issue as invalid.]

1. Create a new java project, insert a JFrame form there
2. Insert a JLabel in the JFrame form
3. Select the JLabel and go to its properties
4. Set foreground color && set background color for the JLabel
5. Foreground color is previewed, background color is not

Up till now, it looks like a duplicat of http://www.netbeans.org/issues/show_bug.cgi?id=130321

However, if you start the application, the JLabels background remain gray as well - the background color as set in the
properties window is not respected - one would assume, that JLabel does not have a background color.

Code generated:

jLabel1.setBackground(new java.awt.Color(100, 231, 39));
jLabel1.setForeground(java.awt.Color.red);
jLabel1.setText("This is My Label!");

Note: the problem described under issue 130321 is about wrong preview in Visual Designer. In other words, the background
color is not displayed in the VD, but it is displayed in the running application. JLabel does not allow to set a
background color anywhere (VD nor running application).
Comment 1 Petr Dvorak 2008-03-17 19:09:06 UTC
Created attachment 58515 [details]
Background color for a label is not modified
Comment 2 Jan Stola 2008-03-18 11:33:09 UTC
The described behaviour is correct - labels are transparent by default on GTK look and feel e.g. their background is 
not painted. If you check the 'opaque' property then the background will be changed as you expect.
Comment 3 Petr Dvorak 2008-03-18 19:54:22 UTC
I see... Sorry for ignorance;o).

Verified
Comment 4 goyalritesh21 2017-06-28 17:11:14 UTC
Created attachment 164650 [details]
Background color is set to black but it does not show any change in the frame.

Please fix it as soon as possible.
Comment 5 Tomas Pavek 2017-06-28 17:37:11 UTC
Have you set the 'opaque' property of the label as mentioned above?