On Thu, 7 Jul 2022 21:03:04 GMT, Phil Race <[email protected]> wrote: > The bug suggests returns true if one of this JLabel's icon or disabled icon > is derived from ImageIcon and it's Image is equal to the image passed in; > false otherwise. > > But looking at the code .. I don't think that is quite right either //// > public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int > h) { // Don't use getDisabledIcon, will trigger creation of icon if icon // > not set. if (!isShowing() || > !SwingUtilities.doesIconReferenceImage(getIcon(), img) && > !SwingUtilities.doesIconReferenceImage(disabledIcon, img)) { > > ``` > return false; > } > return super.imageUpdate(img, infoflags, x, y, w, h); > } > ``` > > /// > > So if they are the same what it actually does isn't return true - it returns > whatever super does ! So the original text was in some ways better and its > main problem was just referring to Icon which is the interface that will only > have an Image if the implementing class is ImageIcon There's also the > isShowing condition which nothing seems to cover. > > So for JLabel we want something like If the component is not showing, or > either the icon or disabled icon is not an {@code ImageIcon} with an {@code > Image} equal to the passed in {@code Image} this method will return false. > Otherwise it will delegate to the super-class. > > What do you think ? > > AbstractButton may need something similar but I'll leave that to you to check
------------- PR: https://git.openjdk.org/jdk/pull/9240
