Class |
Line # |
Actions |
|||
---|---|---|---|---|---|
GCutAndPasteTransfer | 47 | 53 | 20 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
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 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * Jalview is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty | |
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
15 | * PURPOSE. See the GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with Jalview. If not, see <http://www.gnu.org/licenses/>. | |
19 | * The Jalview Authors are detailed in the 'AUTHORS' file. | |
20 | */ | |
21 | package jalview.jbgui; | |
22 | ||
23 | import java.awt.BorderLayout; | |
24 | import java.awt.Font; | |
25 | import java.awt.event.ActionEvent; | |
26 | import java.awt.event.ActionListener; | |
27 | import java.awt.event.MouseEvent; | |
28 | ||
29 | import javax.swing.JButton; | |
30 | import javax.swing.JInternalFrame; | |
31 | import javax.swing.JMenu; | |
32 | import javax.swing.JMenuBar; | |
33 | import javax.swing.JMenuItem; | |
34 | import javax.swing.JPanel; | |
35 | import javax.swing.JScrollPane; | |
36 | import javax.swing.JTextArea; | |
37 | ||
38 | import jalview.gui.JvSwingUtils; | |
39 | import jalview.util.MessageManager; | |
40 | ||
41 | /** | |
42 | * DOCUMENT ME! | |
43 | * | |
44 | * @author $author$ | |
45 | * @version $Revision$ | |
46 | */ | |
47 | public class GCutAndPasteTransfer extends JInternalFrame | |
48 | { | |
49 | protected JTextArea textarea = new JTextArea(); | |
50 | ||
51 | protected JScrollPane scrollPane = new JScrollPane(); | |
52 | ||
53 | BorderLayout borderLayout1 = new BorderLayout(); | |
54 | ||
55 | JMenuBar editMenubar = new JMenuBar(); | |
56 | ||
57 | JMenu editMenu = new JMenu(); | |
58 | ||
59 | JMenuItem copyItem = new JMenuItem(); | |
60 | ||
61 | JMenuItem pasteMenu = new JMenuItem(); | |
62 | ||
63 | JMenuItem fontSizeMenu = new JMenuItem(); | |
64 | ||
65 | BorderLayout borderLayout2 = new BorderLayout(); | |
66 | ||
67 | protected JPanel inputButtonPanel = new JPanel(); | |
68 | ||
69 | protected JButton ok = new JButton(); | |
70 | ||
71 | JButton cancel = new JButton(); | |
72 | ||
73 | JMenuItem selectAll = new JMenuItem(); | |
74 | ||
75 | JMenu jMenu1 = new JMenu(); | |
76 | ||
77 | JMenuItem save = new JMenuItem(); | |
78 | ||
79 | /** | |
80 | * Creates a new GCutAndPasteTransfer object. | |
81 | */ | |
82 | 0 | public GCutAndPasteTransfer() |
83 | { | |
84 | 0 | try |
85 | { | |
86 | 0 | setJMenuBar(editMenubar); |
87 | 0 | jbInit(); |
88 | } catch (Exception e) | |
89 | { | |
90 | 0 | e.printStackTrace(); |
91 | } | |
92 | } | |
93 | ||
94 | /** | |
95 | * DOCUMENT ME! | |
96 | * | |
97 | * @throws Exception | |
98 | * DOCUMENT ME! | |
99 | */ | |
100 | 0 | private void jbInit() throws Exception |
101 | { | |
102 | 0 | setFrameIcon(null); |
103 | 0 | scrollPane.setBorder(null); |
104 | 0 | ok.setFont(JvSwingUtils.getLabelFont()); |
105 | 0 | ok.setText(MessageManager.getString("label.new_window")); |
106 | 0 | ok.addActionListener(new ActionListener() |
107 | { | |
108 | 0 | @Override |
109 | public void actionPerformed(ActionEvent e) | |
110 | { | |
111 | 0 | ok_actionPerformed(e); |
112 | } | |
113 | }); | |
114 | 0 | cancel.setText(MessageManager.getString("action.close")); |
115 | 0 | cancel.addActionListener(new ActionListener() |
116 | { | |
117 | 0 | @Override |
118 | public void actionPerformed(ActionEvent e) | |
119 | { | |
120 | 0 | cancel_actionPerformed(e); |
121 | } | |
122 | }); | |
123 | 0 | textarea.setBorder(null); |
124 | ||
125 | 0 | selectAll.setText(MessageManager.getString("action.select_all")); |
126 | 0 | selectAll |
127 | .setAccelerator( | |
128 | javax.swing.KeyStroke | |
129 | .getKeyStroke(java.awt.event.KeyEvent.VK_A, | |
130 | jalview.util.ShortcutKeyMaskExWrapper | |
131 | .getMenuShortcutKeyMaskEx(), | |
132 | false)); | |
133 | 0 | selectAll.addActionListener(new ActionListener() |
134 | { | |
135 | 0 | @Override |
136 | public void actionPerformed(ActionEvent e) | |
137 | { | |
138 | 0 | selectAll_actionPerformed(e); |
139 | } | |
140 | }); | |
141 | 0 | jMenu1.setText(MessageManager.getString("action.file")); |
142 | 0 | save.setText(MessageManager.getString("action.save")); |
143 | 0 | save.setAccelerator( |
144 | javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, | |
145 | jalview.util.ShortcutKeyMaskExWrapper | |
146 | .getMenuShortcutKeyMaskEx(), | |
147 | false)); | |
148 | 0 | save.addActionListener(new ActionListener() |
149 | { | |
150 | 0 | @Override |
151 | public void actionPerformed(ActionEvent e) | |
152 | { | |
153 | 0 | save_actionPerformed(e); |
154 | } | |
155 | }); | |
156 | 0 | copyItem.setAccelerator( |
157 | javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, | |
158 | jalview.util.ShortcutKeyMaskExWrapper | |
159 | .getMenuShortcutKeyMaskEx(), | |
160 | false)); | |
161 | 0 | pasteMenu |
162 | .setAccelerator( | |
163 | javax.swing.KeyStroke | |
164 | .getKeyStroke(java.awt.event.KeyEvent.VK_V, | |
165 | jalview.util.ShortcutKeyMaskExWrapper | |
166 | .getMenuShortcutKeyMaskEx(), | |
167 | false)); | |
168 | 0 | editMenubar.add(jMenu1); |
169 | 0 | editMenubar.add(editMenu); |
170 | 0 | textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 12)); |
171 | 0 | textarea.addMouseListener(new java.awt.event.MouseAdapter() |
172 | { | |
173 | 0 | @Override |
174 | public void mousePressed(MouseEvent e) | |
175 | { | |
176 | 0 | textarea_mousePressed(e); // on Mac |
177 | } | |
178 | ||
179 | 0 | @Override |
180 | public void mouseReleased(MouseEvent e) | |
181 | { | |
182 | 0 | textarea_mousePressed(e); // on Windows |
183 | } | |
184 | }); | |
185 | 0 | editMenu.setText(MessageManager.getString("action.edit")); |
186 | 0 | pasteMenu.setText(MessageManager.getString("action.paste")); |
187 | 0 | pasteMenu.addActionListener(new ActionListener() |
188 | { | |
189 | 0 | @Override |
190 | public void actionPerformed(ActionEvent e) | |
191 | { | |
192 | 0 | pasteMenu_actionPerformed(e); |
193 | } | |
194 | }); | |
195 | 0 | fontSizeMenu.setText(MessageManager.getString("action.change_font")); |
196 | 0 | fontSizeMenu.addActionListener(new ActionListener() |
197 | { | |
198 | 0 | @Override |
199 | public void actionPerformed(ActionEvent e) | |
200 | { | |
201 | 0 | fontSizeMenu_actionPerformed(e); |
202 | } | |
203 | }); | |
204 | 0 | copyItem.setText(MessageManager.getString("action.copy")); |
205 | 0 | copyItem.addActionListener(new ActionListener() |
206 | { | |
207 | 0 | @Override |
208 | public void actionPerformed(ActionEvent e) | |
209 | { | |
210 | 0 | copyItem_actionPerformed(e); |
211 | } | |
212 | }); | |
213 | 0 | this.getContentPane().setLayout(borderLayout2); |
214 | 0 | scrollPane.setBorder(null); |
215 | 0 | scrollPane.getViewport().add(textarea, null); |
216 | 0 | editMenu.add(selectAll); |
217 | 0 | editMenu.add(copyItem); |
218 | 0 | editMenu.add(pasteMenu); |
219 | 0 | editMenu.add(fontSizeMenu); |
220 | 0 | this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER); |
221 | 0 | inputButtonPanel.add(ok); |
222 | 0 | inputButtonPanel.add(cancel); |
223 | 0 | jMenu1.add(save); |
224 | } | |
225 | ||
226 | /** | |
227 | * DOCUMENT ME! | |
228 | * | |
229 | * @param e | |
230 | * DOCUMENT ME! | |
231 | */ | |
232 | 0 | public void textarea_mousePressed(MouseEvent e) |
233 | { | |
234 | ||
235 | } | |
236 | ||
237 | /** | |
238 | * DOCUMENT ME! | |
239 | * | |
240 | * @param e | |
241 | * DOCUMENT ME! | |
242 | */ | |
243 | 0 | public void copyItem_actionPerformed(ActionEvent e) |
244 | { | |
245 | } | |
246 | ||
247 | /** | |
248 | * DOCUMENT ME! | |
249 | * | |
250 | * @param e | |
251 | * DOCUMENT ME! | |
252 | */ | |
253 | 0 | public void pasteMenu_actionPerformed(ActionEvent e) |
254 | { | |
255 | } | |
256 | ||
257 | /** | |
258 | * shows a menu for changing the font | |
259 | * | |
260 | * @param e | |
261 | */ | |
262 | 0 | public void fontSizeMenu_actionPerformed(ActionEvent e) |
263 | { | |
264 | } | |
265 | ||
266 | /** | |
267 | * DOCUMENT ME! | |
268 | * | |
269 | * @param e | |
270 | * DOCUMENT ME! | |
271 | */ | |
272 | 0 | public void ok_actionPerformed(ActionEvent e) |
273 | { | |
274 | } | |
275 | ||
276 | /** | |
277 | * DOCUMENT ME! | |
278 | * | |
279 | * @param e | |
280 | * DOCUMENT ME! | |
281 | */ | |
282 | 0 | public void cancel_actionPerformed(ActionEvent e) |
283 | { | |
284 | } | |
285 | ||
286 | 0 | public void selectAll_actionPerformed(ActionEvent e) |
287 | { | |
288 | 0 | textarea.selectAll(); |
289 | } | |
290 | ||
291 | 0 | public void save_actionPerformed(ActionEvent e) |
292 | { | |
293 | ||
294 | } | |
295 | } |