Fix so disabled background image doesn't come back when changing themes

This commit is contained in:
drdev
2013-09-13 06:17:49 +00:00
parent a8f3360c40
commit 98d16ba6e1
2 changed files with 16 additions and 4 deletions

View File

@@ -147,6 +147,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
/** @param img0   {@link java.awt.Image} */ /** @param img0   {@link java.awt.Image} */
public void setForegroundImage(final Image img0) { public void setForegroundImage(final Image img0) {
skin.resetForegroundImage(); //must reset if non-skin image set
if (img0 == null) { if (img0 == null) {
this.foregroundImage = null; this.foregroundImage = null;
return; return;
@@ -193,6 +195,8 @@ public class FPanel extends JPanel implements ILocalRepaint {
/** @param img0   {@link java.awt.Image} */ /** @param img0   {@link java.awt.Image} */
public void setBackgroundTexture(final Image img0) { public void setBackgroundTexture(final Image img0) {
skin.resetBackgroundTexture(); //must reset if non-skin image set
if (img0 == null) { return; } if (img0 == null) { return; }
this.backgroundTexture = img0; this.backgroundTexture = img0;

View File

@@ -423,24 +423,32 @@ public enum FSkin {
} }
public void setForegroundImage(SkinImage skinIcon) { public void setForegroundImage(SkinImage skinIcon) {
this.comp.setForegroundImage(skinIcon.image); //must call this first since it will call resetForegroundImage
this.foregroundImage = skinIcon; this.foregroundImage = skinIcon;
this.comp.setForegroundImage(skinIcon.image);
this.needRepaintOnReapply = true; //foreground image draw during paint this.needRepaintOnReapply = true; //foreground image draw during paint
} }
public void resetForegroundImage() {
this.foregroundImage = null;
}
public void setBackgroundTexture(SkinImage skinIcon) { public void setBackgroundTexture(SkinImage skinIcon) {
this.comp.setBackgroundTexture(skinIcon.image); //must call this first since it will call resetBackgroundTexture
this.backgroundTexture = skinIcon; this.backgroundTexture = skinIcon;
this.comp.setBackgroundTexture(skinIcon.image);
this.needRepaintOnReapply = true; //background texture drawn during paint this.needRepaintOnReapply = true; //background texture drawn during paint
} }
public void resetBackgroundTexture() {
this.backgroundTexture = null;
}
@Override @Override
protected void reapply() { protected void reapply() {
if (this.foregroundImage != null) { if (this.foregroundImage != null) {
this.comp.setForegroundImage(this.foregroundImage.image); this.setForegroundImage(this.foregroundImage); //use skin function so foregroundImage field retained
} }
if (this.backgroundTexture != null) { if (this.backgroundTexture != null) {
this.comp.setBackgroundTexture(this.backgroundTexture.image); this.setBackgroundTexture(this.backgroundTexture); //use skin function so backgroundTexture field retained
} }
super.reapply(); super.reapply();
} }