Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/arranger/jarl/shell/views/mainShellPanes/MSPPreviewAnimationPane.java


1   package com.arranger.jarl.shell.views.mainShellPanes;
2   
3   import com.arranger.jarl.shell.models.ViewAnimationModel;
4   
5   import javax.swing.*;
6   import java.awt.*;
7   import java.awt.event.ActionEvent;
8   import java.awt.event.ActionListener;
9   import java.awt.event.KeyEvent;
10  
11  /**
12   * MSPPreviewAnimationPane created on Apr 25, 2003
13   */
14  public class MSPPreviewAnimationPane extends BaseMSP {
15  
16      protected JButton m_previewAnimationButton;
17  
18      /**
19       * Create a component
20       * @return
21       */
22      public Component createComponent() {
23          JPanel renderPanel = new JPanel(new GridLayout(1, 1));
24          m_previewAnimationButton = new JButton("Preview rendered animation");
25          m_previewAnimationButton.setMnemonic(KeyEvent.VK_P);
26          m_previewAnimationButton.addActionListener(new ActionListener() {
27              public void actionPerformed(ActionEvent e) {
28                  confirmAnimation();
29              }
30          });
31  
32          renderPanel.add(m_previewAnimationButton);
33          renderPanel.setBorder(BorderFactory.createTitledBorder("Preivew"));
34  
35          return renderPanel;
36      }
37  
38      protected ViewAnimationModel getViewAnimationModel() {
39          return (ViewAnimationModel) m_jarlShell.getModel(ViewAnimationModel.class.getName());
40      }
41  
42      private void confirmAnimation() {
43          try {
44              ViewAnimationModel vam = (ViewAnimationModel) m_jarlShell.createModel(ViewAnimationModel.class.getName());
45              String outputDir = JOptionPane.showInputDialog(m_jarlShell.getMainJarlShellFrame(),
46                      "Please enter output directory for the rendered animation series: ",
47                      vam.getAnimationDir());
48              vam.setAnimationDir(outputDir);
49  
50              m_jarlShell.setModel(vam);
51              m_jarlShell.saveModels();
52  
53              vam.viewAnimation();
54          } catch (Exception e) {
55              e.printStackTrace();
56          }
57      }
58  }