|
@@ -0,0 +1,185 @@
|
|
|
+ /*
|
|
|
+ * Copyright (c) 2009-2012 jMonkeyEngine
|
|
|
+ * All rights reserved.
|
|
|
+ *
|
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
|
+ * modification, are permitted provided that the following conditions are
|
|
|
+ * met:
|
|
|
+ *
|
|
|
+ * * Redistributions of source code must retain the above copyright
|
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
|
+ *
|
|
|
+ * * Redistributions in binary form must reproduce the above copyright
|
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
|
+ *
|
|
|
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
|
|
|
+ * may be used to endorse or promote products derived from this software
|
|
|
+ * without specific prior written permission.
|
|
|
+ *
|
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
+ */
|
|
|
+package com.jme3.gde.core.sceneexplorer.nodes.actions;
|
|
|
+
|
|
|
+import com.jme3.animation.LoopMode;
|
|
|
+import com.jme3.gde.core.sceneexplorer.nodes.JmeAnimation;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author Nehon
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+public class ChannelDialog extends javax.swing.JDialog {
|
|
|
+
|
|
|
+ JmeAnimation jmeAnim;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Creates new form ChannelDialog
|
|
|
+ */
|
|
|
+ public ChannelDialog(java.awt.Frame parent, boolean modal, JmeAnimation jmeAnim) {
|
|
|
+ super(parent, modal);
|
|
|
+ this.jmeAnim = jmeAnim;
|
|
|
+ initComponents();
|
|
|
+ jTextField1.setText(jmeAnim.getAnimSpeed()+"");
|
|
|
+ jComboBox1.setSelectedItem(jmeAnim.getAnimLoopMode().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 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.
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
|
+ private void initComponents() {
|
|
|
+
|
|
|
+ jPanel1 = new javax.swing.JPanel();
|
|
|
+ jLabel1 = new javax.swing.JLabel();
|
|
|
+ jLabel2 = new javax.swing.JLabel();
|
|
|
+ jComboBox1 = new javax.swing.JComboBox();
|
|
|
+ jTextField1 = new javax.swing.JTextField();
|
|
|
+ jButton1 = new javax.swing.JButton();
|
|
|
+ jButton2 = new javax.swing.JButton();
|
|
|
+
|
|
|
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
|
|
+
|
|
|
+ jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ChannelDialog.class, "ChannelDialog.jPanel1.border.title"))); // NOI18N
|
|
|
+
|
|
|
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ChannelDialog.class, "ChannelDialog.jLabel1.text")); // NOI18N
|
|
|
+
|
|
|
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(ChannelDialog.class, "ChannelDialog.jLabel2.text")); // NOI18N
|
|
|
+
|
|
|
+ jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Loop", "DontLoop", "Cycle" }));
|
|
|
+
|
|
|
+ jTextField1.setText(org.openide.util.NbBundle.getMessage(ChannelDialog.class, "ChannelDialog.jTextField1.text")); // NOI18N
|
|
|
+
|
|
|
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
|
|
+ jPanel1.setLayout(jPanel1Layout);
|
|
|
+ jPanel1Layout.setHorizontalGroup(
|
|
|
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addGroup(jPanel1Layout.createSequentialGroup()
|
|
|
+ .addGap(66, 66, 66)
|
|
|
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
|
+ .addComponent(jLabel2)
|
|
|
+ .addComponent(jLabel1))
|
|
|
+ .addGap(18, 18, 18)
|
|
|
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addComponent(jComboBox1, 0, 142, Short.MAX_VALUE)
|
|
|
+ .addComponent(jTextField1))
|
|
|
+ .addContainerGap())
|
|
|
+ );
|
|
|
+ jPanel1Layout.setVerticalGroup(
|
|
|
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addGroup(jPanel1Layout.createSequentialGroup()
|
|
|
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
|
+ .addComponent(jLabel1)
|
|
|
+ .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
|
+ .addGap(18, 18, 18)
|
|
|
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
|
+ .addComponent(jLabel2)
|
|
|
+ .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
|
+ .addGap(0, 16, Short.MAX_VALUE))
|
|
|
+ );
|
|
|
+
|
|
|
+ org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(ChannelDialog.class, "ChannelDialog.jButton1.text")); // NOI18N
|
|
|
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
|
|
|
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
+ jButton1ActionPerformed(evt);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(ChannelDialog.class, "ChannelDialog.jButton2.text")); // NOI18N
|
|
|
+ jButton2.setActionCommand(org.openide.util.NbBundle.getMessage(ChannelDialog.class, "ChannelDialog.jButton2.actionCommand")); // NOI18N
|
|
|
+ jButton2.addActionListener(new java.awt.event.ActionListener() {
|
|
|
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
+ jButton2ActionPerformed(evt);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
|
+ getContentPane().setLayout(layout);
|
|
|
+ layout.setHorizontalGroup(
|
|
|
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addGroup(layout.createSequentialGroup()
|
|
|
+ .addContainerGap()
|
|
|
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
+ .addComponent(jButton2)
|
|
|
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
+ .addComponent(jButton1)))
|
|
|
+ .addContainerGap())
|
|
|
+ );
|
|
|
+ layout.setVerticalGroup(
|
|
|
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
+ .addGroup(layout.createSequentialGroup()
|
|
|
+ .addContainerGap()
|
|
|
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
|
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
|
+ .addComponent(jButton1)
|
|
|
+ .addComponent(jButton2))
|
|
|
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
|
+ );
|
|
|
+
|
|
|
+ pack();
|
|
|
+ }// </editor-fold>//GEN-END:initComponents
|
|
|
+
|
|
|
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
|
|
+ jmeAnim.setAnimLoopMode(LoopMode.valueOf(jComboBox1.getSelectedItem().toString()));
|
|
|
+ float speed = 1.0f;
|
|
|
+ try{
|
|
|
+ speed = Float.parseFloat(jTextField1.getText());
|
|
|
+ }catch(NumberFormatException e){
|
|
|
+ //wrong format, just setting the speed to 1.0
|
|
|
+ }
|
|
|
+ jmeAnim.setAnimSpeed(speed);
|
|
|
+ setVisible(false);
|
|
|
+ }//GEN-LAST:event_jButton1ActionPerformed
|
|
|
+
|
|
|
+ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
|
|
|
+ setVisible(false);
|
|
|
+ }//GEN-LAST:event_jButton2ActionPerformed
|
|
|
+
|
|
|
+
|
|
|
+ // Variables declaration - do not modify//GEN-BEGIN:variables
|
|
|
+ private javax.swing.JButton jButton1;
|
|
|
+ private javax.swing.JButton jButton2;
|
|
|
+ private javax.swing.JComboBox jComboBox1;
|
|
|
+ private javax.swing.JLabel jLabel1;
|
|
|
+ private javax.swing.JLabel jLabel2;
|
|
|
+ private javax.swing.JPanel jPanel1;
|
|
|
+ private javax.swing.JTextField jTextField1;
|
|
|
+ // End of variables declaration//GEN-END:variables
|
|
|
+}
|