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 157254 - ImageUtilities.loadIcon is missing
Summary: ImageUtilities.loadIcon is missing
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: apireviews
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2009-01-21 16:49 UTC by Jaroslav Tulach
Modified: 2009-02-19 22:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch (4.31 KB, text/plain)
2009-01-26 14:16 UTC, t_h
Details
new patch JG01+Y01 (8.59 KB, text/plain)
2009-01-27 15:08 UTC, t_h
Details
API change patch (9.24 KB, text/plain)
2009-02-09 11:07 UTC, t_h
Details
usage patch (452.90 KB, text/plain)
2009-02-09 11:09 UTC, t_h
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2009-01-21 16:49:33 UTC
Please simplify following changeset
http://hg.netbeans.org/main-golden/rev/42eefaf2a9f8
by introducing ImageUtilities.loadIcon(String,...)
Comment 1 t_h 2009-01-26 14:16:27 UTC
Created attachment 76238 [details]
patch
Comment 2 Jaroslav Tulach 2009-01-26 14:49:58 UTC
Y01 I miss some small, simple test. Otherwise OK.
Comment 3 Milos Kleint 2009-01-26 15:05:39 UTC
looks ok to me.

contrary to jtulach's opinion, I don't think tests of any sort is to be part of the apireview process. it might be
helpful in complex changes to see the api usage, but here it is not serving any purpose.
Comment 4 Jesse Glick 2009-01-26 16:08:51 UTC
[JG01] Javadoc must emphasize that the returned Icon may not be an ImageIcon. This is relevant because Swing components
which grey out when disabled (such as JButton) will generally not work correctly with this method - you really need to
use "new ImageIcon(loadImage(...))". So the method should only be used for situations where it is known that the icon
will not be used for a button, menu item, etc., or if it is, that the button will always be enabled.
Comment 5 t_h 2009-01-27 15:07:16 UTC
> [JG01]
Ok, maybe it would be better to return ImageIcon all the time.
Comment 6 t_h 2009-01-27 15:08:40 UTC
Created attachment 76270 [details]
new patch JG01+Y01
Comment 7 Jesse Glick 2009-01-27 15:55:47 UTC
If you're going to make that change, then you should remove the warning from the Javadoc of image2Icon. (I'm not sure if
there would even be any remaining purpose in the image2Icon method - it would do nothing more than cache ImageIcon
instances for images coming from loadImage, which may or may not be helpful.)

Consider searching for existing code which could use the new method. In Jackpot syntax:

org.openide.util.ImageUtilities.image2Icon(org.openide.util.ImageUtilities.loadImage($r)) =>
org.openide.util.ImageUtilities.loadIcon($r, false);
org.openide.util.ImageUtilities.image2Icon(org.openide.util.ImageUtilities.loadImage($r, $l)) =>
org.openide.util.ImageUtilities.loadIcon($r, $l);
new javax.swing.ImageIcon(org.openide.util.ImageUtilities.loadImage($r)) => org.openide.util.ImageUtilities.loadIcon($r,
false);
new javax.swing.ImageIcon(org.openide.util.ImageUtilities.loadImage($r, $l)) =>
org.openide.util.ImageUtilities.loadIcon($r, $l);
new javax.swing.ImageIcon(org.openide.util.Utilities.loadImage($r)) => org.openide.util.ImageUtilities.loadIcon($r, false);
new javax.swing.ImageIcon(org.openide.util.Utilities.loadImage($r, $l)) => org.openide.util.ImageUtilities.loadIcon($r, $l);
Comment 8 t_h 2009-02-09 11:07:58 UTC
Created attachment 76733 [details]
API change patch
Comment 9 t_h 2009-02-09 11:09:06 UTC
Created attachment 76734 [details]
usage patch
Comment 10 Jesse Glick 2009-02-09 14:32:12 UTC
The Javadoc for loadImageIcon seems to be referring to itself.

Don't forget that usages would need to be matched by spec version increments in the module deps.
Comment 11 t_h 2009-02-11 15:40:02 UTC
Thanks for review. I updated dependencies and fixed Javadoc.
core-main #94f783e8a5a3
core-main #5dc32844e809
Comment 12 Quality Engineering 2009-02-13 09:25:00 UTC
Integrated into 'main-golden', will be available in build *200902130336* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/94f783e8a5a3
User: Tomas Holy <t_h@netbeans.org>
Log: #157254: ImageUtilities.loadIcon is missing