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
This commit is contained in:
parent
d591ae968e
commit
2a7d6582ae
@ -46,6 +46,8 @@ import com.jme3.scene.shape.Quad;
|
|||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.util.SkyFactory;
|
import com.jme3.util.SkyFactory;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,7 +57,7 @@ import javax.swing.JLabel;
|
|||||||
public class DDSPreview implements SceneListener {
|
public class DDSPreview implements SceneListener {
|
||||||
|
|
||||||
private ProjectAssetManager assetManager;
|
private ProjectAssetManager assetManager;
|
||||||
private JLabel picPreview;
|
private JComponent picPreview;
|
||||||
private Geometry quad;
|
private Geometry quad;
|
||||||
private Geometry quad3D;
|
private Geometry quad3D;
|
||||||
private Material material;
|
private Material material;
|
||||||
@ -78,7 +80,7 @@ public class DDSPreview implements SceneListener {
|
|||||||
SceneApplication.getApplication().addSceneListener(this);
|
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);
|
TextureKey key = new TextureKey(textureName);
|
||||||
picPreview = picLabel;
|
picPreview = picLabel;
|
||||||
assetManager.deleteFromCache(key);
|
assetManager.deleteFromCache(key);
|
||||||
@ -131,7 +133,12 @@ public class DDSPreview implements SceneListener {
|
|||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
picPreview.setIcon(icon);
|
if (picPreview instanceof JLabel) {
|
||||||
|
((JLabel) picPreview).setIcon(icon);
|
||||||
|
}
|
||||||
|
if (picPreview instanceof JButton) {
|
||||||
|
((JButton) picPreview).setIcon(icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user