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 javax.swing.*;
\r
31 * @version $Revision$
\r
33 public class GCutAndPasteTransfer extends JInternalFrame
\r
35 protected JTextArea textarea = new JTextArea();
\r
36 protected JScrollPane scrollPane = new JScrollPane();
\r
37 BorderLayout borderLayout1 = new BorderLayout();
\r
38 JMenuBar editMenubar = new JMenuBar();
\r
39 JMenu editMenu = new JMenu();
\r
40 JMenuItem copyItem = new JMenuItem();
\r
41 JMenuItem pasteMenu = new JMenuItem();
\r
42 BorderLayout borderLayout2 = new BorderLayout();
\r
43 protected JPanel inputButtonPanel = new JPanel();
\r
44 JButton ok = new JButton();
\r
45 JButton cancel = new JButton();
\r
46 JMenuItem selectAll = new JMenuItem();
\r
47 JMenu jMenu1 = new JMenu();
\r
48 JMenuItem save = new JMenuItem();
\r
51 * Creates a new GCutAndPasteTransfer object.
\r
53 public GCutAndPasteTransfer()
\r
57 setJMenuBar(editMenubar);
\r
62 e.printStackTrace();
\r
69 * @throws Exception DOCUMENT ME!
\r
71 private void jbInit() throws Exception
\r
73 scrollPane.setBorder(null);
\r
74 ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
75 ok.setText("Accept");
\r
76 ok.addActionListener(new ActionListener()
\r
78 public void actionPerformed(ActionEvent e)
\r
80 ok_actionPerformed(e);
\r
83 cancel.setText("Close");
\r
84 cancel.addActionListener(new ActionListener()
\r
86 public void actionPerformed(ActionEvent e)
\r
88 cancel_actionPerformed(e);
\r
91 textarea.setBorder(null);
\r
93 selectAll.setText("Select All");
\r
94 selectAll.addActionListener(new ActionListener()
\r
96 public void actionPerformed(ActionEvent e)
\r
98 selectAll_actionPerformed(e);
\r
101 jMenu1.setText("File");
\r
102 save.setText("Save");
\r
103 save.addActionListener(new ActionListener()
\r
105 public void actionPerformed(ActionEvent e)
\r
107 save_actionPerformed(e);
\r
110 editMenubar.add(jMenu1);
\r
111 editMenubar.add(editMenu);
\r
112 textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
\r
113 textarea.addMouseListener(new java.awt.event.MouseAdapter()
\r
115 public void mousePressed(MouseEvent e)
\r
117 textarea_mousePressed(e);
\r
120 editMenu.setText("Edit");
\r
121 pasteMenu.setText("Paste");
\r
122 pasteMenu.addActionListener(new ActionListener()
\r
124 public void actionPerformed(ActionEvent e)
\r
126 pasteMenu_actionPerformed(e);
\r
129 copyItem.setText("Copy");
\r
130 copyItem.addActionListener(new ActionListener()
\r
132 public void actionPerformed(ActionEvent e)
\r
134 copyItem_actionPerformed(e);
\r
137 this.getContentPane().setLayout(borderLayout2);
\r
138 scrollPane.setBorder(null);
\r
139 scrollPane.getViewport().add(textarea, null);
\r
140 editMenu.add(selectAll);
\r
141 editMenu.add(copyItem);
\r
142 editMenu.add(pasteMenu);
\r
143 this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
\r
144 inputButtonPanel.add(ok);
\r
145 inputButtonPanel.add(cancel);
\r
152 * @param e DOCUMENT ME!
\r
154 public void textarea_mousePressed(MouseEvent e)
\r
162 * @param e DOCUMENT ME!
\r
164 public void copyItem_actionPerformed(ActionEvent e)
\r
171 * @param e DOCUMENT ME!
\r
173 public void pasteMenu_actionPerformed(ActionEvent e)
\r
180 * @param e DOCUMENT ME!
\r
182 public void ok_actionPerformed(ActionEvent e)
\r
189 * @param e DOCUMENT ME!
\r
191 public void cancel_actionPerformed(ActionEvent e)
\r
196 public void selectAll_actionPerformed(ActionEvent e)
\r
198 textarea.selectAll();
\r
201 public void save_actionPerformed(ActionEvent e)
\r