textarea.append(text);\r
}\r
\r
+\r
+ public void save_actionPerformed(ActionEvent e)\r
+ {\r
+ JalviewFileChooser chooser = new JalviewFileChooser(\r
+ jalview.bin.Cache.getProperty(\r
+ "LAST_DIRECTORY"));\r
+\r
+ chooser.setAcceptAllFileFilterUsed(false);\r
+ chooser.setFileView(new JalviewFileView());\r
+ chooser.setDialogTitle("Save Text to File");\r
+ chooser.setToolTipText("Save");\r
+\r
+ int value = chooser.showSaveDialog(this);\r
+\r
+ if (value == JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ try\r
+ {\r
+ java.io.PrintWriter out = new java.io.PrintWriter(\r
+ new java.io.FileWriter(chooser.getSelectedFile()));\r
+\r
+ out.print(getText());\r
+ out.close();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+\r
+ }\r
+ }\r
+\r
+\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
catch (Exception ex)\r
{\r
}\r
-\r
}\r
- try\r
- {\r
- this.setClosed(true);\r
- }\r
- catch (Exception ex)\r
- {\r
- }\r
}\r
}\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
\r
-import java.beans.PropertyChangeEvent;\r
-//import java.beans.PropertyVetoException;\r
-//import java.beans.VetoableChangeListener;\r
-\r
import javax.swing.*;\r
\r
\r
JButton ok = new JButton();\r
JButton cancel = new JButton();\r
JMenuItem selectAll = new JMenuItem();\r
+ JMenu jMenu1 = new JMenu();\r
+ JMenuItem save = new JMenuItem();\r
\r
/**\r
* Creates a new GCutAndPasteTransfer object.\r
ok_actionPerformed(e);\r
}\r
});\r
- cancel.setText("Cancel");\r
+ cancel.setText("Close");\r
cancel.addActionListener(new ActionListener()\r
{\r
public void actionPerformed(ActionEvent e)\r
selectAll_actionPerformed(e);\r
}\r
});\r
+ jMenu1.setText("File");\r
+ save.setText("Save");\r
+ save.addActionListener(new ActionListener()\r
+ {\r
+ public void actionPerformed(ActionEvent e)\r
+ {\r
+ save_actionPerformed(e);\r
+ }\r
+ });\r
+ editMenubar.add(jMenu1);\r
editMenubar.add(editMenu);\r
textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));\r
textarea.addMouseListener(new java.awt.event.MouseAdapter()\r
this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);\r
inputButtonPanel.add(ok);\r
inputButtonPanel.add(cancel);\r
- }\r
+ jMenu1.add(save);\r
+ }\r
\r
/**\r
* DOCUMENT ME!\r
{\r
textarea.selectAll();\r
}\r
+\r
+ public void save_actionPerformed(ActionEvent e)\r
+ {\r
+\r
+ }\r
}\r