2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2006 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 protected 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("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
204 public void selectAll_actionPerformed(ActionEvent e)
\r
206 textarea.selectAll();
\r
209 public void save_actionPerformed(ActionEvent e)
\r