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
95 selectAll.setText("Select All");
\r
96 selectAll.addActionListener(new ActionListener()
\r
98 public void actionPerformed(ActionEvent e)
\r
100 selectAll_actionPerformed(e);
\r
103 editMenubar.add(editMenu);
\r
104 textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
\r
105 textarea.addMouseListener(new java.awt.event.MouseAdapter()
\r
107 public void mousePressed(MouseEvent e)
\r
109 textarea_mousePressed(e);
\r
112 editMenu.setText("Edit");
\r
113 pasteMenu.setText("Paste");
\r
114 pasteMenu.addActionListener(new ActionListener()
\r
116 public void actionPerformed(ActionEvent e)
\r
118 pasteMenu_actionPerformed(e);
\r
121 copyItem.setText("Copy");
\r
122 copyItem.addActionListener(new ActionListener()
\r
124 public void actionPerformed(ActionEvent e)
\r
126 copyItem_actionPerformed(e);
\r
129 this.getContentPane().setLayout(borderLayout2);
\r
130 scrollPane.setBorder(null);
\r
131 scrollPane.getViewport().add(textarea, null);
\r
132 editMenu.add(selectAll);
\r
133 editMenu.add(copyItem);
\r
134 editMenu.add(pasteMenu);
\r
135 this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
\r
136 inputButtonPanel.add(ok);
\r
137 inputButtonPanel.add(cancel);
\r
143 * @param e DOCUMENT ME!
\r
145 public void textarea_mousePressed(MouseEvent e)
\r
153 * @param e DOCUMENT ME!
\r
155 public void copyItem_actionPerformed(ActionEvent e)
\r
162 * @param e DOCUMENT ME!
\r
164 public void pasteMenu_actionPerformed(ActionEvent e)
\r
171 * @param e DOCUMENT ME!
\r
173 public void ok_actionPerformed(ActionEvent e)
\r
180 * @param e DOCUMENT ME!
\r
182 public void cancel_actionPerformed(ActionEvent e)
\r
187 public void selectAll_actionPerformed(ActionEvent e)
\r
189 textarea.selectAll();
\r