2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.jbgui;
\r
22 import java.awt.event.*;
\r
24 import java.beans.PropertyChangeEvent;
\r
25 import java.beans.PropertyVetoException;
\r
26 import java.beans.VetoableChangeListener;
\r
28 import javax.swing.*;
\r
35 * @version $Revision$
\r
37 public class GCutAndPasteTransfer extends JInternalFrame
\r
39 protected JTextArea textarea = new JTextArea();
\r
40 protected JScrollPane scrollPane = new JScrollPane();
\r
41 BorderLayout borderLayout1 = new BorderLayout();
\r
42 JMenuBar editMenubar = new JMenuBar();
\r
43 JMenu editMenu = new JMenu();
\r
44 JMenuItem copyItem = new JMenuItem();
\r
45 JMenuItem pasteMenu = new JMenuItem();
\r
46 BorderLayout borderLayout2 = new BorderLayout();
\r
47 protected JPanel inputButtonPanel = new JPanel();
\r
48 JButton ok = new JButton();
\r
49 JButton cancel = new JButton();
\r
52 * Creates a new GCutAndPasteTransfer object.
\r
54 public GCutAndPasteTransfer()
\r
58 setJMenuBar(editMenubar);
\r
63 e.printStackTrace();
\r
70 * @throws Exception DOCUMENT ME!
\r
72 private void jbInit() throws Exception
\r
74 scrollPane.setBorder(null);
\r
75 ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
76 ok.setText("Accept");
\r
77 ok.addActionListener(new ActionListener()
\r
79 public void actionPerformed(ActionEvent e)
\r
81 ok_actionPerformed(e);
\r
84 cancel.setText("Cancel");
\r
85 cancel.addActionListener(new ActionListener()
\r
87 public void actionPerformed(ActionEvent e)
\r
89 cancel_actionPerformed(e);
\r
92 textarea.setBorder(null);
\r
93 textarea.addVetoableChangeListener(new VetoableChangeListener()
\r
95 public void vetoableChange(PropertyChangeEvent evt)
\r
99 textarea_vetoableChange(evt);
\r
101 catch (java.beans.PropertyVetoException exception0)
\r
103 exception0.printStackTrace();
\r
107 editMenubar.add(editMenu);
\r
108 textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
\r
109 textarea.addMouseListener(new java.awt.event.MouseAdapter()
\r
111 public void mousePressed(MouseEvent e)
\r
113 textarea_mousePressed(e);
\r
116 editMenu.setText("Edit");
\r
117 pasteMenu.setText("Paste");
\r
118 pasteMenu.addActionListener(new ActionListener()
\r
120 public void actionPerformed(ActionEvent e)
\r
122 pasteMenu_actionPerformed(e);
\r
125 copyItem.setText("Copy");
\r
126 copyItem.addActionListener(new ActionListener()
\r
128 public void actionPerformed(ActionEvent e)
\r
130 copyItem_actionPerformed(e);
\r
133 this.getContentPane().setLayout(borderLayout2);
\r
134 scrollPane.setBorder(null);
\r
135 scrollPane.getViewport().add(textarea, null);
\r
136 editMenu.add(copyItem);
\r
137 editMenu.add(pasteMenu);
\r
138 this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
\r
139 inputButtonPanel.add(ok);
\r
140 inputButtonPanel.add(cancel);
\r
146 * @param e DOCUMENT ME!
\r
148 void textarea_mousePressed(MouseEvent e)
\r
150 if (textarea.getText().equals("Paste your alignment file here"))
\r
152 textarea.setText("");
\r
159 * @param e DOCUMENT ME!
\r
161 public void copyItem_actionPerformed(ActionEvent e)
\r
168 * @param e DOCUMENT ME!
\r
170 public void pasteMenu_actionPerformed(ActionEvent e)
\r
177 * @param e DOCUMENT ME!
\r
179 public void ok_actionPerformed(ActionEvent e)
\r
186 * @param e DOCUMENT ME!
\r
188 public void cancel_actionPerformed(ActionEvent e)
\r
195 * @param evt DOCUMENT ME!
\r
197 * @throws PropertyVetoException DOCUMENT ME!
\r
199 public void textarea_vetoableChange(PropertyChangeEvent evt)
\r
200 throws PropertyVetoException
\r