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 jalview.gui.JvSwingUtils; |
24 |
|
import jalview.util.MessageManager; |
25 |
|
|
26 |
|
import java.awt.BorderLayout; |
27 |
|
import java.awt.Color; |
28 |
|
import java.awt.Dimension; |
29 |
|
import java.awt.Font; |
30 |
|
import java.awt.Rectangle; |
31 |
|
import java.awt.event.ActionEvent; |
32 |
|
import java.awt.event.ActionListener; |
33 |
|
|
34 |
|
import javax.swing.JButton; |
35 |
|
import javax.swing.JCheckBox; |
36 |
|
import javax.swing.JComboBox; |
37 |
|
import javax.swing.JLabel; |
38 |
|
import javax.swing.JPanel; |
39 |
|
import javax.swing.SwingConstants; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
@author |
45 |
|
@version |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 123 (123) |
Complexity: 21 |
Complexity Density: 0.2 |
|
47 |
|
public class GFontChooser extends JPanel |
48 |
|
{ |
49 |
|
private static final Font VERDANA_11PT = new java.awt.Font("Verdana", 0, |
50 |
|
11); |
51 |
|
|
52 |
|
protected JComboBox<Integer> fontSize = new JComboBox<Integer>(); |
53 |
|
|
54 |
|
protected JComboBox<String> fontStyle = new JComboBox<String>(); |
55 |
|
|
56 |
|
protected JComboBox<String> fontName = new JComboBox<String>(); |
57 |
|
|
58 |
|
protected JButton defaultButton = new JButton(); |
59 |
|
|
60 |
|
protected JCheckBox smoothFont = new JCheckBox(); |
61 |
|
|
62 |
|
protected JCheckBox monospaced = new JCheckBox(); |
63 |
|
|
64 |
|
protected JCheckBox scaleAsCdna = new JCheckBox(); |
65 |
|
|
66 |
|
protected JCheckBox fontAsCdna = new JCheckBox(); |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
71 |
0 |
public GFontChooser()... |
72 |
|
{ |
73 |
0 |
try |
74 |
|
{ |
75 |
0 |
jbInit(); |
76 |
|
} catch (Exception e) |
77 |
|
{ |
78 |
0 |
e.printStackTrace(); |
79 |
|
} |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@throws |
86 |
|
|
87 |
|
|
|
|
| 0% |
Uncovered Elements: 91 (91) |
Complexity: 1 |
Complexity Density: 0.01 |
|
88 |
0 |
private void jbInit() throws Exception... |
89 |
|
{ |
90 |
0 |
this.setLayout(null); |
91 |
0 |
this.setBackground(Color.white); |
92 |
|
|
93 |
0 |
JLabel fontLabel = new JLabel(MessageManager.getString("label.font")); |
94 |
0 |
fontLabel.setFont(VERDANA_11PT); |
95 |
0 |
fontLabel.setHorizontalAlignment(SwingConstants.RIGHT); |
96 |
0 |
fontLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); |
97 |
|
|
98 |
0 |
fontSize.setFont(VERDANA_11PT); |
99 |
0 |
fontSize.setOpaque(false); |
100 |
0 |
fontSize.setPreferredSize(new Dimension(50, 21)); |
101 |
0 |
fontSize.addActionListener(new java.awt.event.ActionListener() |
102 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
0 |
@Override... |
104 |
|
public void actionPerformed(ActionEvent e) |
105 |
|
{ |
106 |
0 |
fontSize_actionPerformed(); |
107 |
|
} |
108 |
|
}); |
109 |
|
|
110 |
0 |
fontStyle.setFont(VERDANA_11PT); |
111 |
0 |
fontStyle.setOpaque(false); |
112 |
0 |
fontStyle.setPreferredSize(new Dimension(90, 21)); |
113 |
0 |
fontStyle.addActionListener(new java.awt.event.ActionListener() |
114 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
0 |
@Override... |
116 |
|
public void actionPerformed(ActionEvent e) |
117 |
|
{ |
118 |
0 |
fontStyle_actionPerformed(); |
119 |
|
} |
120 |
|
}); |
121 |
|
|
122 |
0 |
JLabel sizeLabel = new JLabel(MessageManager.getString("label.size")); |
123 |
0 |
sizeLabel.setFont(VERDANA_11PT); |
124 |
0 |
sizeLabel.setHorizontalAlignment(SwingConstants.RIGHT); |
125 |
0 |
sizeLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); |
126 |
|
|
127 |
0 |
JLabel styleLabel = new JLabel(MessageManager.getString("label.style")); |
128 |
0 |
styleLabel.setFont(VERDANA_11PT); |
129 |
0 |
styleLabel.setHorizontalAlignment(SwingConstants.RIGHT); |
130 |
0 |
styleLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); |
131 |
|
|
132 |
0 |
fontName.setFont(VERDANA_11PT); |
133 |
0 |
fontName.setMaximumSize(new Dimension(32767, 32767)); |
134 |
0 |
fontName.setMinimumSize(new Dimension(300, 21)); |
135 |
0 |
fontName.setOpaque(false); |
136 |
0 |
fontName.setPreferredSize(new Dimension(180, 21)); |
137 |
0 |
fontName.addActionListener(new java.awt.event.ActionListener() |
138 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
139 |
0 |
@Override... |
140 |
|
public void actionPerformed(ActionEvent e) |
141 |
|
{ |
142 |
0 |
fontName_actionPerformed(); |
143 |
|
} |
144 |
|
}); |
145 |
|
|
146 |
0 |
JButton ok = new JButton(MessageManager.getString("action.ok")); |
147 |
0 |
ok.setFont(VERDANA_11PT); |
148 |
0 |
ok.addActionListener(new java.awt.event.ActionListener() |
149 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
0 |
@Override... |
151 |
|
public void actionPerformed(ActionEvent e) |
152 |
|
{ |
153 |
0 |
ok_actionPerformed(); |
154 |
|
} |
155 |
|
}); |
156 |
|
|
157 |
0 |
JButton cancel = new JButton(MessageManager.getString("action.cancel")); |
158 |
0 |
cancel.setFont(VERDANA_11PT); |
159 |
0 |
cancel.addActionListener(new java.awt.event.ActionListener() |
160 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
161 |
0 |
@Override... |
162 |
|
public void actionPerformed(ActionEvent e) |
163 |
|
{ |
164 |
0 |
cancel_actionPerformed(); |
165 |
|
} |
166 |
|
}); |
167 |
|
|
168 |
0 |
defaultButton.setFont(JvSwingUtils.getLabelFont()); |
169 |
0 |
defaultButton.setText(MessageManager.getString("label.set_as_default")); |
170 |
0 |
defaultButton.addActionListener(new ActionListener() |
171 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
172 |
0 |
@Override... |
173 |
|
public void actionPerformed(ActionEvent e) |
174 |
|
{ |
175 |
0 |
defaultButton_actionPerformed(); |
176 |
|
} |
177 |
|
}); |
178 |
|
|
179 |
0 |
smoothFont.setFont(JvSwingUtils.getLabelFont()); |
180 |
0 |
smoothFont.setOpaque(false); |
181 |
0 |
smoothFont.setText(MessageManager.getString("label.anti_alias_fonts")); |
182 |
0 |
smoothFont.setBounds(new Rectangle(1, 65, 300, 23)); |
183 |
0 |
smoothFont.addActionListener(new ActionListener() |
184 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
185 |
0 |
@Override... |
186 |
|
public void actionPerformed(ActionEvent e) |
187 |
|
{ |
188 |
0 |
smoothFont_actionPerformed(); |
189 |
|
} |
190 |
|
}); |
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
0 |
scaleAsCdna.setVisible(false); |
196 |
0 |
scaleAsCdna.setFont(JvSwingUtils.getLabelFont()); |
197 |
0 |
scaleAsCdna.setOpaque(false); |
198 |
0 |
scaleAsCdna.setText(MessageManager.getString("label.scale_as_cdna")); |
199 |
0 |
scaleAsCdna.setBounds(new Rectangle(1, 85, 300, 23)); |
200 |
0 |
scaleAsCdna.addActionListener(new ActionListener() |
201 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
202 |
0 |
@Override... |
203 |
|
public void actionPerformed(ActionEvent e) |
204 |
|
{ |
205 |
0 |
scaleAsCdna_actionPerformed(); |
206 |
|
} |
207 |
|
}); |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
0 |
fontAsCdna.setVisible(false); |
213 |
0 |
fontAsCdna.setFont(JvSwingUtils.getLabelFont()); |
214 |
0 |
fontAsCdna.setOpaque(false); |
215 |
0 |
fontAsCdna.setText(MessageManager.getString("label.font_as_cdna")); |
216 |
0 |
fontAsCdna.setBounds(new Rectangle(1, 105, 350, 23)); |
217 |
0 |
fontAsCdna.addActionListener(new ActionListener() |
218 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
219 |
0 |
@Override... |
220 |
|
public void actionPerformed(ActionEvent e) |
221 |
|
{ |
222 |
0 |
mirrorFonts_actionPerformed(); |
223 |
|
} |
224 |
|
}); |
225 |
|
|
226 |
0 |
monospaced.setEnabled(false); |
227 |
0 |
monospaced.setFont(JvSwingUtils.getLabelFont()); |
228 |
0 |
monospaced.setOpaque(false); |
229 |
0 |
monospaced.setToolTipText(MessageManager |
230 |
|
.getString("label.monospaced_fonts_faster_to_render")); |
231 |
0 |
monospaced.setText(MessageManager.getString("label.monospaced_font")); |
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
0 |
JPanel jPanel1 = new JPanel(); |
237 |
0 |
jPanel1.setOpaque(false); |
238 |
0 |
jPanel1.setBounds(new Rectangle(5, 6, 308, 23)); |
239 |
0 |
jPanel1.setLayout(new BorderLayout()); |
240 |
0 |
jPanel1.add(fontLabel, BorderLayout.WEST); |
241 |
0 |
jPanel1.add(fontName, BorderLayout.CENTER); |
242 |
0 |
jPanel1.add(monospaced, java.awt.BorderLayout.EAST); |
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
0 |
JPanel jPanel2 = new JPanel(); |
248 |
0 |
jPanel2.setOpaque(false); |
249 |
0 |
jPanel2.setBounds(new Rectangle(5, 37, 128, 21)); |
250 |
0 |
jPanel2.setLayout(new BorderLayout()); |
251 |
0 |
jPanel2.add(fontSize, java.awt.BorderLayout.CENTER); |
252 |
0 |
jPanel2.add(sizeLabel, java.awt.BorderLayout.WEST); |
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
0 |
JPanel jPanel3 = new JPanel(); |
258 |
0 |
jPanel3.setOpaque(false); |
259 |
0 |
jPanel3.setBounds(new Rectangle(174, 38, 134, 21)); |
260 |
0 |
jPanel3.setLayout(new BorderLayout()); |
261 |
0 |
jPanel3.add(styleLabel, java.awt.BorderLayout.WEST); |
262 |
0 |
jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER); |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
0 |
JPanel jPanel4 = new JPanel(); |
268 |
0 |
jPanel4.setOpaque(false); |
269 |
0 |
jPanel4.setBounds(new Rectangle(24, 132, 300, 35)); |
270 |
0 |
jPanel4.add(defaultButton); |
271 |
0 |
jPanel4.add(ok); |
272 |
0 |
jPanel4.add(cancel); |
273 |
|
|
274 |
0 |
this.add(smoothFont); |
275 |
0 |
this.add(scaleAsCdna); |
276 |
0 |
this.add(fontAsCdna); |
277 |
0 |
this.add(jPanel3, null); |
278 |
0 |
this.add(jPanel2, null); |
279 |
0 |
this.add(jPanel4); |
280 |
0 |
this.add(jPanel1, null); |
281 |
|
} |
282 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
283 |
0 |
protected void mirrorFonts_actionPerformed()... |
284 |
|
{ |
285 |
|
} |
286 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
287 |
0 |
protected void scaleAsCdna_actionPerformed()... |
288 |
|
{ |
289 |
|
} |
290 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
291 |
0 |
protected void ok_actionPerformed()... |
292 |
|
{ |
293 |
|
} |
294 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
295 |
0 |
protected void cancel_actionPerformed()... |
296 |
|
{ |
297 |
|
} |
298 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
299 |
0 |
protected void fontName_actionPerformed()... |
300 |
|
{ |
301 |
|
} |
302 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
303 |
0 |
protected void fontSize_actionPerformed()... |
304 |
|
{ |
305 |
|
} |
306 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
307 |
0 |
protected void fontStyle_actionPerformed()... |
308 |
|
{ |
309 |
|
} |
310 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
311 |
0 |
public void defaultButton_actionPerformed()... |
312 |
|
{ |
313 |
|
} |
314 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
315 |
0 |
protected void smoothFont_actionPerformed()... |
316 |
|
{ |
317 |
|
} |
318 |
|
} |