public void stopRender() throws Exception {
   if (renderThread != null) {
     if (doRecordCBx.isSelected()) {
       actionRecorder.recordStop();
     }
     renderThread.setForceAbort(true);
     if (doRecordCBx.isSelected()) {
       JFileChooser chooser = new FlameFileChooser(prefs);
       if (prefs.getOutputFlamePath() != null) {
         try {
           chooser.setCurrentDirectory(new File(prefs.getOutputFlamePath()));
         } catch (Exception ex) {
           ex.printStackTrace();
         }
       }
       if (chooser.showSaveDialog(flameRootPanel) == JFileChooser.APPROVE_OPTION) {
         File file = chooser.getSelectedFile();
         prefs.setLastOutputFlameFile(file);
         PostRecordFlameGenerator generator =
             new PostRecordFlameGenerator(
                 Prefs.getPrefs(), project, actionRecorder, renderThread, project.getFFT());
         generator.createRecordedFlameFiles(file.getAbsolutePath());
       }
     }
     renderThread = null;
     actionRecorder = null;
   }
 }
 public void flameCmb_changed() {
   if (!refreshing && renderThread != null) {
     Flame selFlame =
         flamesCmb.getSelectedIndex() >= 0
                 && flamesCmb.getSelectedIndex() < project.getFlames().size()
             ? project.getFlames().get(flamesCmb.getSelectedIndex())
             : null;
     if (selFlame != null && renderThread != null) {
       int morphFrameCount = Integer.parseInt(morphFrameCountIEd.getText());
       renderThread
           .getFlameStack()
           .addFlame(selFlame, morphFrameCount, project.getMotions(selFlame));
       if (actionRecorder != null) actionRecorder.recordFlameChange(selFlame, morphFrameCount);
     }
   }
 }
 public void startRender() throws Exception {
   stopRender();
   Flame selFlame =
       flamesCmb.getSelectedIndex() >= 0
               && flamesCmb.getSelectedIndex() < project.getFlames().size()
           ? project.getFlames().get(flamesCmb.getSelectedIndex())
           : null;
   renderThread = new RealtimeAnimRenderThread(this, project);
   renderThread.getFlameStack().addFlame(selFlame, 0, project.getMotions(selFlame));
   actionRecorder = new ActionRecorder(renderThread);
   renderThread.setFFTData(project.getFFT());
   renderThread.setMusicPlayer(jLayer);
   renderThread.setFFTPanel(getGraph1Panel());
   renderThread.setFramesPerSecond(Integer.parseInt(framesPerSecondIEd.getText()));
   renderThread.setDrawTriangles(drawTrianglesCbx.isSelected());
   renderThread.setDrawFFT(drawFFTCbx.isSelected());
   renderThread.setDrawFPS(drawFPSCbx.isSelected());
   actionRecorder.recordStart(selFlame);
   new Thread(renderThread).start();
 }
 public void drawFPSCBx_changed() {
   if (renderThread != null) {
     renderThread.setDrawFPS(drawFPSCbx.isSelected());
   }
 }
 public void drawTrianglesCBx_changed() {
   if (renderThread != null) {
     renderThread.setDrawTriangles(drawTrianglesCbx.isSelected());
   }
 }