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

Summary: API for creation of low color saturation icons for disabled buttons
Product: platform Reporter: t_h <t_h>
Component: -- Other --Assignee: t_h <t_h>
Status: RESOLVED FIXED    
Severity: blocker CC: apireviews
Priority: P2 Keywords: API, API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: diff
Thanks, updated patch with suggestions + Actions update

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]
diff
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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/9ce2679e8a86
User: Tomas Holy <t_h@netbeans.org>
Log: #171400: API for creation of low color saturation icons for disabled buttons