2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.jbgui;
20 import jalview.gui.JvSwingUtils;
23 import java.awt.event.*;
32 public class GCutAndPasteTransfer extends JInternalFrame
34 protected JTextArea textarea = new JTextArea();
36 protected JScrollPane scrollPane = new JScrollPane();
38 BorderLayout borderLayout1 = new BorderLayout();
40 JMenuBar editMenubar = new JMenuBar();
42 JMenu editMenu = new JMenu();
44 JMenuItem copyItem = new JMenuItem();
46 JMenuItem pasteMenu = new JMenuItem();
48 BorderLayout borderLayout2 = new BorderLayout();
50 protected JPanel inputButtonPanel = new JPanel();
52 protected JButton ok = new JButton();
54 JButton cancel = new JButton();
56 JMenuItem selectAll = new JMenuItem();
58 JMenu jMenu1 = new JMenu();
60 JMenuItem save = new JMenuItem();
63 * Creates a new GCutAndPasteTransfer object.
65 public GCutAndPasteTransfer()
69 setJMenuBar(editMenubar);
83 private void jbInit() throws Exception
85 scrollPane.setBorder(null);
86 ok.setFont(JvSwingUtils.getLabelFont());
87 ok.setText("New Window");
88 ok.addActionListener(new ActionListener()
90 public void actionPerformed(ActionEvent e)
92 ok_actionPerformed(e);
95 cancel.setText("Close");
96 cancel.addActionListener(new ActionListener()
98 public void actionPerformed(ActionEvent e)
100 cancel_actionPerformed(e);
103 textarea.setBorder(null);
105 selectAll.setText("Select All");
106 selectAll.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
107 java.awt.event.KeyEvent.VK_A, Toolkit.getDefaultToolkit()
108 .getMenuShortcutKeyMask(), false));
109 selectAll.addActionListener(new ActionListener()
111 public void actionPerformed(ActionEvent e)
113 selectAll_actionPerformed(e);
116 jMenu1.setText("File");
117 save.setText("Save");
118 save.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
119 java.awt.event.KeyEvent.VK_S, Toolkit.getDefaultToolkit()
120 .getMenuShortcutKeyMask(), false));
121 save.addActionListener(new ActionListener()
123 public void actionPerformed(ActionEvent e)
125 save_actionPerformed(e);
128 copyItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
129 java.awt.event.KeyEvent.VK_C, Toolkit.getDefaultToolkit()
130 .getMenuShortcutKeyMask(), false));
131 pasteMenu.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
132 java.awt.event.KeyEvent.VK_V, Toolkit.getDefaultToolkit()
133 .getMenuShortcutKeyMask(), false));
134 editMenubar.add(jMenu1);
135 editMenubar.add(editMenu);
136 textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12));
137 textarea.addMouseListener(new java.awt.event.MouseAdapter()
139 public void mousePressed(MouseEvent e)
141 textarea_mousePressed(e);
144 editMenu.setText("Edit");
145 pasteMenu.setText("Paste");
146 pasteMenu.addActionListener(new ActionListener()
148 public void actionPerformed(ActionEvent e)
150 pasteMenu_actionPerformed(e);
153 copyItem.setText("Copy");
154 copyItem.addActionListener(new ActionListener()
156 public void actionPerformed(ActionEvent e)
158 copyItem_actionPerformed(e);
161 this.getContentPane().setLayout(borderLayout2);
162 scrollPane.setBorder(null);
163 scrollPane.getViewport().add(textarea, null);
164 editMenu.add(selectAll);
165 editMenu.add(copyItem);
166 editMenu.add(pasteMenu);
167 this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
168 inputButtonPanel.add(ok);
169 inputButtonPanel.add(cancel);
179 public void textarea_mousePressed(MouseEvent e)
190 public void copyItem_actionPerformed(ActionEvent e)
200 public void pasteMenu_actionPerformed(ActionEvent e)
210 public void ok_actionPerformed(ActionEvent e)
220 public void cancel_actionPerformed(ActionEvent e)
224 public void selectAll_actionPerformed(ActionEvent e)
226 textarea.selectAll();
229 public void save_actionPerformed(ActionEvent e)