예제 #1
0
 @Override
 public void actionPerformed(java.awt.event.ActionEvent evt) {
   Runnable runnable =
       new Runnable() {
         @Override
         public void run() {
           JFileChooser fileChooser = MainFrame.getFileChooser();
           fileChooser.setFileFilter(fileChooser.getAcceptAllFileFilter());
           fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
           fileChooser.setMultiSelectionEnabled(false);
           if (fileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
             File file = fileChooser.getSelectedFile();
             try {
               MainFrame.lockGUI("Serializing JAPE Transducer...");
               FileOutputStream out = new FileOutputStream(file);
               ObjectOutputStream s = new ObjectOutputStream(out);
               serialize(s);
               s.close();
               out.close();
             } catch (IOException ioe) {
               JOptionPane.showMessageDialog(
                   MainFrame.getInstance(),
                   "Error!\n" + ioe.toString(),
                   "GATE",
                   JOptionPane.ERROR_MESSAGE);
               ioe.printStackTrace(Err.getPrintWriter());
             } finally {
               MainFrame.unlockGUI();
             }
           }
         }
       };
   Thread thread = new Thread(runnable, "Transduer Serialization");
   thread.setPriority(Thread.MIN_PRIORITY);
   thread.start();
 }