From 2a7d6582ae38a0013b2cf62eba1d2a5c85700e4e Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Tue, 16 Aug 2011 11:06:19 +0000 Subject: [PATCH] SDK : - Allowed the dds preview to display on a button git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8016 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../gde/core/properties/preview/DDSPreview.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/preview/DDSPreview.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/preview/DDSPreview.java index cd1ec7cb6..4ea8e6a3e 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/preview/DDSPreview.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/preview/DDSPreview.java @@ -46,6 +46,8 @@ import com.jme3.scene.shape.Quad; import com.jme3.texture.Texture; import com.jme3.util.SkyFactory; import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComponent; import javax.swing.JLabel; /** @@ -55,7 +57,7 @@ import javax.swing.JLabel; public class DDSPreview implements SceneListener { private ProjectAssetManager assetManager; - private JLabel picPreview; + private JComponent picPreview; private Geometry quad; private Geometry quad3D; private Material material; @@ -78,7 +80,7 @@ public class DDSPreview implements SceneListener { SceneApplication.getApplication().addSceneListener(this); } - public void requestPreview(String textureName, String displayName, int width, int height, JLabel picLabel, JLabel infoLabel) { + public void requestPreview(String textureName, String displayName, int width, int height, JComponent picLabel, JLabel infoLabel) { TextureKey key = new TextureKey(textureName); picPreview = picLabel; assetManager.deleteFromCache(key); @@ -131,7 +133,12 @@ public class DDSPreview implements SceneListener { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { - picPreview.setIcon(icon); + if (picPreview instanceof JLabel) { + ((JLabel) picPreview).setIcon(icon); + } + if (picPreview instanceof JButton) { + ((JButton) picPreview).setIcon(icon); + } } }); }