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 16991 - Color Editor: Standard swing colors should show names from swing palette
Summary: Color Editor: Standard swing colors should show names from swing palette
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-26 01:47 UTC by Rochelle Raccah
Modified: 2008-04-28 13:37 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Stact trace (1.60 KB, text/plain)
2004-02-19 17:08 UTC, _ lcincura
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rochelle Raccah 2001-10-26 01:47:47 UTC
If I set the background color of a JTextArea to Label.background, the property
editor shows a swatch of the color with Label.background as the text.  However,
if I create a JLabel and don't edit the background color at all, the property
sheet shows 204,204,204 as the text next to the swatch.  I think it should show
Label.background.

I'm not sure whether the drop down choices should automatically change to the
swing palette too.  Maybe they shouldn't until the user explicitly chooses a
color from that palette.
Comment 1 Tomas Pavek 2001-10-30 08:28:18 UTC
This not possible - there is no unambiguous way how to get UI manager 
color strings from RGB values. If you choose the color from the Swing 
palette in ColorEditor, a special color object is created which 
contains additional info about the color. But i JLabel and other 
components, there's just a simple java.awt.Color.
Comment 2 Rochelle Raccah 2002-01-04 18:03:07 UTC
There has been discussion about this issue on nbui and HIE people have
determined that the idea has merit and should be for the 4.0
timeframe.  Please see the thread at
<http://www.netbeans.org/servlets/BrowseList?listName=nbui&by=thread&from=9155>
Comment 3 Tomas Pavek 2002-01-07 18:21:14 UTC
Well, I don't say the idea is wrong. I just don't know how this could 
be implemented... The only thing I can imagine is to duplicate the 
ColorEditor from core in form module and tweak it somehow. But then 
we will have two almost same property editors, one working only for 
forms?

So I don't know...
Comment 4 Rochelle Raccah 2002-01-07 18:35:10 UTC
The first thing to do is to decide what is desired.  After that we can 
decide if the solution is form specific or should be used for all 
color editors.  I see 2 possibilities:
1) Use the standard (core) property editor as a PropertyPanel solution 
and do something special in form.
2) Make a change to the core property editor.
Comment 5 Tomas Pavek 2002-01-07 18:50:19 UTC
I'm talking about the case, when something like "label.background" 
should be displayed for color that *has not been changed*. This is 
the desired behaviour, isn't it? But there's no way (or I don't know 
about any), how to tell the ColorEditor from core (which displays the 
color) that certain color is a label's background - ColorEditor 
receives only Color object with e.g. [204,204,204] - so it cannot 
know it is just "label.background" and not "button.background" or 
something completely different.
I'll investigate this further if PropertyEnv could not be used 
somehow ... but it definitely cannot be solved in ColorEditor only.
Comment 6 Rochelle Raccah 2002-01-07 18:59:58 UTC
I understand.  I'm sure David will be open to adding more hints to the 
core editor if it is necessary.  Let's wait and see what the desired 
behavior is.
Comment 7 Tomas Pavek 2002-01-21 08:49:54 UTC
I think this is just an enhancement request, not defect.
Comment 8 _ lcincura 2004-02-19 17:08:27 UTC
Created attachment 13531 [details]
Stact trace
Comment 9 _ lcincura 2004-02-19 17:09:49 UTC
I am sorry, the attachment does not belong to the issue.
Comment 10 Tomas Pavek 2005-05-16 18:04:53 UTC
After more than 3 years I still don't see a way how this could be done. I think
the fact that JLabel background is shown as [212,208,200] is now rather minor
issue - as the property clearly communicates that the value was not set (changed).

The thing that is important here is how to make the user choose the colors from
the symbolic palettes (i.e. Swing palette mainly) so they don't specify
hardcoded colors (that would not match on different platform/look&feel), but
colors that are obtained from UIManager table via a key.

So e.g. if the user wants a textfield with "grey" background, they should not
choose [212,208,200] as this is only Windows color, but they should choose Swing
Palette -> Panel.background, which will generate code like:
jTextField1.setBackground(javax.swing.UIManager.getDefaults().getColor("Panel.background"));
which will provide the correct color on all platforms.