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 171400 - API for creation of low color saturation icons for disabled buttons
Summary: API for creation of low color saturation icons for disabled buttons
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: t_h
Depends on:
Reported: 2009-09-03 13:30 UTC by t_h
Modified: 2009-09-11 21:43 UTC (History)
1 user (show)

See Also:
Exception Reporter:

diff (10.48 KB, text/plain)
2009-09-03 13:37 UTC, t_h
Thanks, updated patch with suggestions + Actions update (21.32 KB, text/plain)
2009-09-04 11:38 UTC, t_h

Note You need to log in before you can comment on or make changes to this bug.
Description t_h 2009-09-03 13:30:20 UTC
NB uses "low color saturation" icons for disabled buttons in toolbar and menu. It would be nice and more consistent if
such icons would be used also for other disabled buttons instead of default grayed icons. New method for conversion is
needed in ImageUtilities.
Comment 1 t_h 2009-09-03 13:37:02 UTC
Created attachment 87046 [details]
Comment 2 t_h 2009-09-03 13:41:02 UTC
Please review.
Comment 3 Jesse Glick 2009-09-03 15:44:31 UTC
Good. Consider pushing the Swing team to make AbstractButton use something similar. Last I checked their implementation
of disabled icons only handles ImageIcon and just does nothing if you pass in any other Icon implementation.

[JG01] The condition

  icon == null || !(icon instanceof Icon)

is just a verbose way of saying

  !(icon instanceof Icon)

[JG02] Unsynchronized lazy initialization of DISABLED_BUTTON_FILTER is potentially incorrect; just make it a final
constant. Init of disabledIcon is also suspect, unless you are positive this is called only from EQ (in which case add
an assertion to that effect).

BTW tip: when writing apichanges.xml entries in a diff for review, better to set the <date> to the date on which you
expect the review to close, say 7 days from when it was opened. Otherwise you are liable to forget and leave the wrong
date in.
Comment 4 Jaroslav Tulach 2009-09-04 09:05:55 UTC
Y01 I am slightly surprised that createDisabledIcon takes Image and returns Icon. Slightly unintuitive. Would not it 
be better (symmetric, intuitive, nicer) to have two:
public static Image createDisabledImage(Image)
public static Icon createDisabledIcon(Icon)
as far as I remember we also have dual Image+Icon objects with easy convertibility so the implementation shall not be 
less effective.
Comment 5 t_h 2009-09-04 11:38:14 UTC
Created attachment 87099 [details]
Thanks, updated patch with suggestions + Actions update
Comment 6 t_h 2009-09-10 14:37:50 UTC
core-main #9ce2679e8a86
Comment 7 Quality Engineering 2009-09-11 21:43:25 UTC
Integrated into 'main-golden', will be available in build *200909111401* on (upload may still be in progress)
User: Tomas Holy <>
Log: #171400: API for creation of low color saturation icons for disabled buttons