Skip to content

Commit 3677b55

Browse files
kumarabhi006prsadhuk
authored andcommittedAug 9, 2022
6391806: JLabel and AbstractButton's imageUpdate method should be better specified
Reviewed-by: psadhukhan, prr
1 parent 0ade264 commit 3677b55

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed
 

‎src/java.desktop/share/classes/javax/swing/AbstractButton.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -2146,11 +2146,12 @@ protected void init(String text, Icon icon) {
21462146

21472147

21482148
/**
2149-
* This is overridden to return false if the current <code>Icon</code>'s
2150-
* <code>Image</code> is not equal to the
2151-
* passed in <code>Image</code> <code>img</code>.
2149+
* If the button icon for the current button state is either {@code null}
2150+
* or not an {@code ImageIcon} with an {@code Image} equal to the
2151+
* passed in {@code Image}, return {@code false}; otherwise it
2152+
* will delegate to the super-class.
21522153
*
2153-
* @param img the <code>Image</code> to be compared
2154+
* @param img the {@code Image} to be compared
21542155
* @param infoflags flags used to repaint the button when the image
21552156
* is updated and which determine how much is to be painted
21562157
* @param x the x coordinate

‎src/java.desktop/share/classes/javax/swing/JLabel.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,18 @@ public void setHorizontalTextPosition(int textPosition) {
874874

875875

876876
/**
877-
* This is overridden to return false if the current Icon's Image is
878-
* not equal to the passed in Image <code>img</code>.
877+
* If the component is not showing or either the icon or disabled
878+
* icon is not an {@code ImageIcon} with an {@code Image}
879+
* equal to the passed in {@code Image}, return {@code false};
880+
* otherwise it will delegate to the super-class.
881+
*
882+
* @param img the {@code Image} to be compared
883+
* @param infoflags flags used to repaint the label when the image
884+
* is updated and which determine how much is to be painted
885+
* @param x the x coordinate
886+
* @param y the y coordinate
887+
* @param w the width
888+
* @param h the height
879889
*
880890
* @see java.awt.image.ImageObserver
881891
* @see java.awt.Component#imageUpdate(java.awt.Image, int, int, int, int, int)

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Aug 9, 2022

@openjdk-notifier[bot]
Please sign in to comment.