diff --git a/src/main/java/forge/gui/toolbox/FLabel.java b/src/main/java/forge/gui/toolbox/FLabel.java index 62715aca24e..fa952937bea 100644 --- a/src/main/java/forge/gui/toolbox/FLabel.java +++ b/src/main/java/forge/gui/toolbox/FLabel.java @@ -364,10 +364,6 @@ public class FLabel extends JLabel implements ILocalRepaint { } } }; - - public void setIcon(FSkin.SkinImage icon) { - this.skin.setIcon(icon); - } //========== Methods /** @param b0   boolean */ @@ -447,21 +443,31 @@ public class FLabel extends JLabel implements ILocalRepaint { return this.cmdRightClick; } + public void setIcon(FSkin.SkinImage icon) { + this.skin.setIcon(icon); + } + @Override // Must be public. public void setIcon(final Icon i0) { - if (i0 == null) { this.img = null; return; } // Will need image (not icon) for scaled and non-scaled. - if (iconInBackground) { this.img = ((ImageIcon) i0).getImage(); } // Will need image if not in background, but scaled. - else if (iconScaleAuto) { this.img = ((ImageIcon) i0).getImage(); } - // If not in background, not scaled, can use original icon. - else { super.setIcon(i0); } - - if (img != null) { - iw = img.getWidth(null); - ih = img.getHeight(null); - iar = ((double) iw) / ((double) ih); + if (iconInBackground || iconScaleAuto) { + if (i0 != null) { + img = ((ImageIcon) i0).getImage(); + iw = img.getWidth(null); + ih = img.getHeight(null); + iar = ((double) iw) / ((double) ih); + } + else { + img = null; + iw = 0; + ih = 0; + iar = 0; + } + } + else { // If not in background, not scaled, can use original icon. + super.setIcon(i0); } } diff --git a/src/main/java/forge/gui/toolbox/FSkin.java b/src/main/java/forge/gui/toolbox/FSkin.java index a29d1fa5edf..025552e4a09 100644 --- a/src/main/java/forge/gui/toolbox/FSkin.java +++ b/src/main/java/forge/gui/toolbox/FSkin.java @@ -855,7 +855,7 @@ public enum FSkin { final Graphics2D g2d = resizedImage.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2d.drawImage(baseImage.image, 0, 0, w0, h0, 0, 0, baseImage.getWidth(), baseImage.getHeight(), null); + g2d.drawImage(baseImage.image, 0, 0, w, h, 0, 0, baseImage.getWidth(), baseImage.getHeight(), null); g2d.dispose(); this.changeImage(resizedImage, null);