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
50 JMenuItem selectAll = new JMenuItem();
\r
53 * Creates a new GCutAndPasteTransfer object.
\r
55 public GCutAndPasteTransfer()
\r
59 setJMenuBar(editMenubar);
\r
64 e.printStackTrace();
\r
71 * @throws Exception DOCUMENT ME!
\r
73 private void jbInit() throws Exception
\r
75 scrollPane.setBorder(null);
\r
76 ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
77 ok.setText("Accept");
\r
78 ok.addActionListener(new ActionListener()
\r
80 public void actionPerformed(ActionEvent e)
\r
82 ok_actionPerformed(e);
\r
85 cancel.setText("Cancel");
\r
86 cancel.addActionListener(new ActionListener()
\r
88 public void actionPerformed(ActionEvent e)
\r
90 cancel_actionPerformed(e);
\r
93 textarea.setBorder(null);
\r
94 textarea.addVetoableChangeListener(new VetoableChangeListener()
\r
96 public void vetoableChange(PropertyChangeEvent evt)
\r
100 textarea_vetoableChange(evt);
\r
102 catch (java.beans.PropertyVetoException exception0)
\r
104 exception0.printStackTrace();
\r
108 selectAll.setText("Select All");
\r
109 selectAll.addActionListener(new ActionListener()
\r
111 public void actionPerformed(ActionEvent e)
\r
113 selectAll_actionPerformed(e);
\r
116 editMenubar.add(editMenu);
\r
117 textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
\r
118 textarea.addMouseListener(new java.awt.event.MouseAdapter()
\r
120 public void mousePressed(MouseEvent e)
\r
122 textarea_mousePressed(e);
\r
125 editMenu.setText("Edit");
\r
126 pasteMenu.setText("Paste");
\r
127 pasteMenu.addActionListener(new ActionListener()
\r
129 public void actionPerformed(ActionEvent e)
\r
131 pasteMenu_actionPerformed(e);
\r
134 copyItem.setText("Copy");
\r
135 copyItem.addActionListener(new ActionListener()
\r
137 public void actionPerformed(ActionEvent e)
\r
139 copyItem_actionPerformed(e);
\r
142 this.getContentPane().setLayout(borderLayout2);
\r
143 scrollPane.setBorder(null);
\r
144 scrollPane.getViewport().add(textarea, null);
\r
145 editMenu.add(selectAll);
\r
146 editMenu.add(copyItem);
\r
147 editMenu.add(pasteMenu);
\r
148 this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
\r
149 inputButtonPanel.add(ok);
\r
150 inputButtonPanel.add(cancel);
\r
156 * @param e DOCUMENT ME!
\r
158 public void textarea_mousePressed(MouseEvent e)
\r
166 * @param e DOCUMENT ME!
\r
168 public void copyItem_actionPerformed(ActionEvent e)
\r
175 * @param e DOCUMENT ME!
\r
177 public void pasteMenu_actionPerformed(ActionEvent e)
\r
184 * @param e DOCUMENT ME!
\r
186 public void ok_actionPerformed(ActionEvent e)
\r
193 * @param e DOCUMENT ME!
\r
195 public void cancel_actionPerformed(ActionEvent e)
\r
202 * @param evt DOCUMENT ME!
\r
204 * @throws PropertyVetoException DOCUMENT ME!
\r
206 public void textarea_vetoableChange(PropertyChangeEvent evt)
\r
207 throws PropertyVetoException
\r
211 public void selectAll_actionPerformed(ActionEvent e)
\r
213 textarea.selectAll();
\r