2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2007 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
23 import javax.swing.*;
\r
29 * @version $Revision$
\r
31 public class GCutAndPasteTransfer
\r
32 extends JInternalFrame
\r
34 protected JTextArea textarea = new JTextArea();
\r
35 protected JScrollPane scrollPane = new JScrollPane();
\r
36 BorderLayout borderLayout1 = new BorderLayout();
\r
37 JMenuBar editMenubar = new JMenuBar();
\r
38 JMenu editMenu = new JMenu();
\r
39 JMenuItem copyItem = new JMenuItem();
\r
40 JMenuItem pasteMenu = new JMenuItem();
\r
41 BorderLayout borderLayout2 = new BorderLayout();
\r
42 protected JPanel inputButtonPanel = new JPanel();
\r
43 protected JButton ok = new JButton();
\r
44 JButton cancel = new JButton();
\r
45 JMenuItem selectAll = new JMenuItem();
\r
46 JMenu jMenu1 = new JMenu();
\r
47 JMenuItem save = new JMenuItem();
\r
50 * Creates a new GCutAndPasteTransfer object.
\r
52 public GCutAndPasteTransfer()
\r
56 setJMenuBar(editMenubar);
\r
61 e.printStackTrace();
\r
68 * @throws Exception DOCUMENT ME!
\r
70 private void jbInit()
\r
73 scrollPane.setBorder(null);
\r
74 ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
75 ok.setText("New Window");
\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.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
\r
95 KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
\r
96 selectAll.addActionListener(new ActionListener()
\r
98 public void actionPerformed(ActionEvent e)
\r
100 selectAll_actionPerformed(e);
\r
103 jMenu1.setText("File");
\r
104 save.setText("Save");
\r
105 save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
\r
106 KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
\r
107 save.addActionListener(new ActionListener()
\r
109 public void actionPerformed(ActionEvent e)
\r
111 save_actionPerformed(e);
\r
114 copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
\r
115 KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
\r
116 pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.
\r
117 KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
\r
118 editMenubar.add(jMenu1);
\r
119 editMenubar.add(editMenu);
\r
120 textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
\r
121 textarea.addMouseListener(new java.awt.event.MouseAdapter()
\r
123 public void mousePressed(MouseEvent e)
\r
125 textarea_mousePressed(e);
\r
128 editMenu.setText("Edit");
\r
129 pasteMenu.setText("Paste");
\r
130 pasteMenu.addActionListener(new ActionListener()
\r
132 public void actionPerformed(ActionEvent e)
\r
134 pasteMenu_actionPerformed(e);
\r
137 copyItem.setText("Copy");
\r
138 copyItem.addActionListener(new ActionListener()
\r
140 public void actionPerformed(ActionEvent e)
\r
142 copyItem_actionPerformed(e);
\r
145 this.getContentPane().setLayout(borderLayout2);
\r
146 scrollPane.setBorder(null);
\r
147 scrollPane.getViewport().add(textarea, null);
\r
148 editMenu.add(selectAll);
\r
149 editMenu.add(copyItem);
\r
150 editMenu.add(pasteMenu);
\r
151 this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
\r
152 inputButtonPanel.add(ok);
\r
153 inputButtonPanel.add(cancel);
\r
160 * @param e DOCUMENT ME!
\r
162 public void textarea_mousePressed(MouseEvent e)
\r
170 * @param e DOCUMENT ME!
\r
172 public void copyItem_actionPerformed(ActionEvent e)
\r
179 * @param e DOCUMENT ME!
\r
181 public void pasteMenu_actionPerformed(ActionEvent e)
\r
188 * @param e DOCUMENT ME!
\r
190 public void ok_actionPerformed(ActionEvent e)
\r
197 * @param e DOCUMENT ME!
\r
199 public void cancel_actionPerformed(ActionEvent e)
\r
203 public void selectAll_actionPerformed(ActionEvent e)
\r
205 textarea.selectAll();
\r
208 public void save_actionPerformed(ActionEvent e)
\r