From b545fffcbd0f4442a351ae6a169098af404c44b5 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Wed, 3 Oct 2012 02:02:12 +0000 Subject: [PATCH] SDK: - make EffectTrackVisualPanel not fail when no particle emitter is available git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9815 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../impl/tracks/EffectTrackVisualPanel1.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java index 075df46d2..461c924e8 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/impl/tracks/EffectTrackVisualPanel1.java @@ -48,7 +48,9 @@ public final class EffectTrackVisualPanel1 extends JPanel { Spatial rootNode; JmeAnimation animation; - /** Creates new form EffectTrackVisualPanel1 */ + /** + * Creates new form EffectTrackVisualPanel1 + */ public EffectTrackVisualPanel1(Spatial rootNode, JmeAnimation animation) { this.rootNode = rootNode; this.animation = animation; @@ -59,9 +61,12 @@ public final class EffectTrackVisualPanel1 extends JPanel { populateModel(rootNode, model); jComboBox1.setModel(model); jComboBox1.setRenderer(new ListCellRenderer() { - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - return new JLabel(((Spatial) value).getName()); + if (value instanceof Spatial) { + return new JLabel(((Spatial) value).getName()); + } else{ + return new JLabel("?"); + } } }); jSlider1.setMaximum((int) (animation.getLookup().lookup(Animation.class).getLength() * 100)); @@ -91,10 +96,10 @@ public final class EffectTrackVisualPanel1 extends JPanel { return (float) jSlider1.getValue() / 100f; } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ // //GEN-BEGIN:initComponents private void initComponents() {