1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
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 |
|
|
43 |
|
|
44 |
|
@author |
45 |
|
@version |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 72 (72) |
Complexity: 20 |
Complexity Density: 0.38 |
|
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 |
|
|
81 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
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 |
|
|
96 |
|
|
97 |
|
@throws |
98 |
|
|
99 |
|
|
|
|
| 0% |
Uncovered Elements: 39 (39) |
Complexity: 1 |
Complexity Density: 0.03 |
|
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
0 |
@Override... |
174 |
|
public void mousePressed(MouseEvent e) |
175 |
|
{ |
176 |
0 |
textarea_mousePressed(e); |
177 |
|
} |
178 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
179 |
0 |
@Override... |
180 |
|
public void mouseReleased(MouseEvent e) |
181 |
|
{ |
182 |
0 |
textarea_mousePressed(e); |
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
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 |
|
|
228 |
|
|
229 |
|
@param |
230 |
|
|
231 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
232 |
0 |
public void textarea_mousePressed(MouseEvent e)... |
233 |
|
{ |
234 |
|
|
235 |
|
} |
236 |
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
@param |
241 |
|
|
242 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
243 |
0 |
public void copyItem_actionPerformed(ActionEvent e)... |
244 |
|
{ |
245 |
|
} |
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
@param |
251 |
|
|
252 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
253 |
0 |
public void pasteMenu_actionPerformed(ActionEvent e)... |
254 |
|
{ |
255 |
|
} |
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
@param |
261 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
262 |
0 |
public void fontSizeMenu_actionPerformed(ActionEvent e)... |
263 |
|
{ |
264 |
|
} |
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
@param |
270 |
|
|
271 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
272 |
0 |
public void ok_actionPerformed(ActionEvent e)... |
273 |
|
{ |
274 |
|
} |
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
@param |
280 |
|
|
281 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
282 |
0 |
public void cancel_actionPerformed(ActionEvent e)... |
283 |
|
{ |
284 |
|
} |
285 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
286 |
0 |
public void selectAll_actionPerformed(ActionEvent e)... |
287 |
|
{ |
288 |
0 |
textarea.selectAll(); |
289 |
|
} |
290 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
291 |
0 |
public void save_actionPerformed(ActionEvent e)... |
292 |
|
{ |
293 |
|
|
294 |
|
} |
295 |
|
} |