2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.jbgui;
24 import javax.swing.border.TitledBorder;
25 import java.awt.event.*;
26 import javax.swing.event.*;
28 import java.awt.Rectangle;
29 import java.awt.Insets;
37 public class GPreferences extends JPanel
39 JTabbedPane tabbedPane = new JTabbedPane();
41 JButton ok = new JButton();
42 JButton cancel = new JButton();
43 JPanel okCancelPanel = new JPanel();
44 BorderLayout borderLayout1 = new BorderLayout();
45 protected JCheckBox quality = new JCheckBox();
46 JPanel visualTab = new JPanel();
47 protected JCheckBox fullScreen = new JCheckBox();
48 protected JCheckBox conservation = new JCheckBox();
49 protected JCheckBox identity = new JCheckBox();
50 protected JCheckBox annotations = new JCheckBox();
51 JLabel gapLabel = new JLabel();
52 protected JComboBox colour = new JComboBox();
53 JLabel colourLabel = new JLabel();
54 JLabel fontLabel = new JLabel();
55 protected JComboBox fontSizeCB = new JComboBox();
56 protected JComboBox fontStyleCB = new JComboBox();
57 protected JComboBox fontNameCB = new JComboBox();
58 protected JComboBox gapSymbolCB = new JComboBox();
59 protected JCheckBox startupCheckbox = new JCheckBox();
60 protected JTextField startupFileTextfield = new JTextField();
61 JPanel connectTab = new JPanel();
62 JLabel serverLabel = new JLabel();
63 protected JList linkURLList = new JList();
64 protected JTextField proxyServerTB = new JTextField();
65 protected JTextField proxyPortTB = new JTextField();
66 JLabel portLabel = new JLabel();
67 JLabel browserLabel = new JLabel();
68 protected JTextField defaultBrowser = new JTextField();
69 JButton newLink = new JButton();
70 JButton editLink = new JButton();
71 JButton deleteLink = new JButton();
72 JScrollPane linkScrollPane = new JScrollPane();
73 JPanel linkPanel = new JPanel();
74 BorderLayout borderLayout2 = new BorderLayout();
75 JPanel editLinkButtons = new JPanel();
76 GridLayout gridLayout1 = new GridLayout();
77 protected JList linkNameList = new JList();
78 JPanel linkPanel2 = new JPanel();
79 BorderLayout borderLayout3 = new BorderLayout();
80 protected JCheckBox useProxy = new JCheckBox();
81 JPanel jPanel1 = new JPanel();
82 TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
83 TitledBorder titledBorder2 = new TitledBorder("File Output");
84 GridBagLayout gridBagLayout2 = new GridBagLayout();
85 GridBagLayout gridBagLayout1 = new GridBagLayout();
86 GridBagLayout gridBagLayout3 = new GridBagLayout();
87 protected JComboBox sortby = new JComboBox();
88 JLabel sortLabel = new JLabel();
89 JPanel jPanel2 = new JPanel();
90 GridLayout gridLayout2 = new GridLayout();
91 JPanel jPanel3 = new JPanel();
92 JPanel exportTab = new JPanel();
93 JLabel epsLabel = new JLabel();
94 protected JComboBox epsRendering = new JComboBox();
95 JLabel jLabel1 = new JLabel();
96 protected JCheckBox blcjv = new JCheckBox();
97 protected JCheckBox pileupjv = new JCheckBox();
98 protected JCheckBox clustaljv = new JCheckBox();
99 protected JCheckBox msfjv = new JCheckBox();
100 protected JCheckBox fastajv = new JCheckBox();
101 protected JCheckBox pfamjv = new JCheckBox();
102 FlowLayout flowLayout1 = new FlowLayout();
103 protected JCheckBox pirjv = new JCheckBox();
104 JPanel jPanel11 = new JPanel();
105 Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);
106 protected JCheckBox seqLimit = new JCheckBox();
107 GridLayout gridLayout3 = new GridLayout();
108 protected JCheckBox smoothFont = new JCheckBox();
109 JPanel calcTab = new JPanel();
110 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
111 protected JCheckBox padGaps = new JCheckBox();
112 protected JCheckBox modellerOutput = new JCheckBox();
113 protected JPanel dasPanel = new JPanel();
114 BorderLayout borderLayout4 = new BorderLayout();
115 protected JCheckBox wrap = new JCheckBox();
117 * Creates a new GPreferences object.
119 public GPreferences()
127 ex.printStackTrace();
134 * @throws Exception DOCUMENT ME!
136 private void jbInit() throws Exception
138 this.setLayout(borderLayout1);
140 ok.addActionListener(new ActionListener()
142 public void actionPerformed(ActionEvent e)
144 ok_actionPerformed(e);
147 cancel.setText("Cancel");
148 cancel.addActionListener(new ActionListener()
150 public void actionPerformed(ActionEvent e)
152 cancel_actionPerformed(e);
155 quality.setEnabled(false);
156 quality.setFont(verdana11);
157 quality.setHorizontalAlignment(SwingConstants.RIGHT);
158 quality.setHorizontalTextPosition(SwingConstants.LEFT);
159 quality.setSelected(true);
160 quality.setText("Quality");
161 visualTab.setBorder(new TitledBorder("Open new alignment"));
162 visualTab.setLayout(null);
163 fullScreen.setFont(verdana11);
164 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
165 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
166 fullScreen.setMargin(new Insets(2, 2, 2, 0));
167 fullScreen.setText("Maximise Window");
168 conservation.setEnabled(false);
169 conservation.setFont(verdana11);
170 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
171 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
172 conservation.setSelected(true);
173 conservation.setText("Conservation");
174 identity.setEnabled(false);
175 identity.setFont(verdana11);
176 identity.setHorizontalAlignment(SwingConstants.RIGHT);
177 identity.setHorizontalTextPosition(SwingConstants.LEFT);
178 identity.setSelected(true);
179 identity.setText("Consensus");
180 annotations.setFont(verdana11);
181 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
182 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
183 annotations.setMargin(new Insets(2, 2, 2, 0));
184 annotations.setSelected(true);
185 annotations.setText("Show Annotations");
186 annotations.addActionListener(new ActionListener()
188 public void actionPerformed(ActionEvent e)
190 annotations_actionPerformed(e);
193 gapLabel.setFont(verdana11);
194 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
195 gapLabel.setText("Gap Symbol ");
196 colour.setFont(verdana11);
197 colour.setBounds(new Rectangle(172, 188, 155, 21));
198 colourLabel.setFont(verdana11);
199 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
200 colourLabel.setText("Colour ");
201 fontLabel.setFont(verdana11);
202 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
203 fontLabel.setText("Font ");
204 fontSizeCB.setFont(verdana11);
205 fontSizeCB.setBounds(new Rectangle(317, 92, 49, 21));
206 fontStyleCB.setFont(verdana11);
207 fontStyleCB.setBounds(new Rectangle(364, 92, 70, 21));
208 fontNameCB.setFont(verdana11);
209 fontNameCB.setBounds(new Rectangle(171, 92, 147, 21));
210 gapSymbolCB.setFont(verdana11);
211 gapSymbolCB.setBounds(new Rectangle(172, 163, 69, 21));
212 startupCheckbox.setText("Open file");
213 startupCheckbox.setFont(verdana11);
214 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
215 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
216 startupCheckbox.setSelected(true);
217 startupFileTextfield.setFont(verdana11);
218 startupFileTextfield.setBounds(new Rectangle(171, 236, 270, 20));
219 startupFileTextfield.addMouseListener(new MouseAdapter()
221 public void mouseClicked(MouseEvent e)
223 if (e.getClickCount() > 1)
225 startupFileTextfield_mouseClicked();
230 connectTab.setLayout(gridBagLayout3);
231 serverLabel.setText("Address");
232 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
233 serverLabel.setFont(verdana11);
234 proxyServerTB.setFont(verdana11);
235 proxyPortTB.setFont(verdana11);
236 portLabel.setFont(verdana11);
237 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
238 portLabel.setText("Port");
239 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
240 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
241 browserLabel.setText("Default Browser (Unix)");
242 defaultBrowser.setFont(verdana11);
243 defaultBrowser.setText("");
244 newLink.setText("New");
245 newLink.addActionListener(new java.awt.event.ActionListener() {
246 public void actionPerformed(ActionEvent e) {
247 newLink_actionPerformed(e);
250 editLink.setText("Edit");
251 editLink.addActionListener(new java.awt.event.ActionListener() {
252 public void actionPerformed(ActionEvent e) {
253 editLink_actionPerformed(e);
256 deleteLink.setText("Delete");
257 deleteLink.addActionListener(new java.awt.event.ActionListener() {
258 public void actionPerformed(ActionEvent e) {
259 deleteLink_actionPerformed(e);
263 linkURLList.addListSelectionListener(new ListSelectionListener()
265 public void valueChanged(ListSelectionEvent e)
267 int index = linkURLList.getSelectedIndex();
268 linkNameList.setSelectedIndex(index);
272 linkNameList.addListSelectionListener(new ListSelectionListener()
274 public void valueChanged(ListSelectionEvent e)
276 int index = linkNameList.getSelectedIndex();
277 linkURLList.setSelectedIndex(index);
281 linkScrollPane.setBorder(null);
282 linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
283 linkPanel.setLayout(borderLayout2);
284 editLinkButtons.setLayout(gridLayout1);
285 gridLayout1.setRows(3);
286 linkNameList.setFont(verdana11);
287 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
288 linkPanel2.setLayout(borderLayout3);
289 linkURLList.setFont(verdana11);
290 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
292 defaultBrowser.addMouseListener(new MouseAdapter()
294 public void mouseClicked(MouseEvent e)
296 if (e.getClickCount() > 1)
298 defaultBrowser_mouseClicked(e);
302 useProxy.setFont(verdana11);
303 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
304 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
305 useProxy.setText("Use a proxy server");
306 useProxy.addActionListener(new ActionListener()
308 public void actionPerformed(ActionEvent e)
310 useProxy_actionPerformed();
313 jPanel1.setBorder(titledBorder1);
314 jPanel1.setLayout(gridBagLayout1);
315 sortby.setFont(verdana11);
316 sortby.setBounds(new Rectangle(171, 213, 155, 21));
317 sortLabel.setFont(verdana11);
318 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
319 sortLabel.setText("Sort by ");
320 jPanel2.setBounds(new Rectangle(7, 17, 158, 245));
321 jPanel2.setLayout(gridLayout2);
322 gridLayout2.setRows(10);
323 jPanel3.setBounds(new Rectangle(169, 39, 274, 26));
324 exportTab.setLayout(null);
325 epsLabel.setFont(verdana11);
326 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
327 epsLabel.setText("EPS Rendering Style");
328 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
329 epsRendering.setFont(verdana11);
330 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
331 jLabel1.setFont(verdana11);
332 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
333 jLabel1.setText("Append /start-end (/15-380)");
334 jLabel1.setFont(verdana11);
335 fastajv.setFont(verdana11);
336 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
337 clustaljv.setText("Clustal ");
338 blcjv.setText("BLC ");
339 fastajv.setText("Fasta ");
340 msfjv.setText("MSF ");
341 pfamjv.setText("PFAM ");
342 pileupjv.setText("Pileup ");
343 msfjv.setFont(verdana11);
344 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
345 pirjv.setText("PIR ");
346 jPanel11.setFont(verdana11);
347 jPanel11.setBorder(titledBorder2);
348 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
349 jPanel11.setLayout(gridLayout3);
350 blcjv.setFont(verdana11);
351 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
352 clustaljv.setFont(verdana11);
353 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
354 pfamjv.setFont(verdana11);
355 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
356 pileupjv.setFont(verdana11);
357 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
358 pirjv.setFont(verdana11);
359 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
360 seqLimit.setFont(verdana11);
361 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
362 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
363 seqLimit.setMargin(new Insets(2, 2, 2, 0));
364 seqLimit.setText("Full Sequence Id");
365 gridLayout3.setRows(8);
366 smoothFont.setFont(verdana11);
367 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
368 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
369 smoothFont.setText("Smooth Font");
370 calcTab.setLayout(null);
371 autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
372 autoCalculateConsCheck.setText("AutoCalculate Consensus");
373 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
374 padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
375 padGaps.setText("Pad gaps when editing");
376 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
377 modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
378 modellerOutput.setText("Use Modeller Output");
379 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
380 dasPanel.setLayout(borderLayout4);
381 wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
382 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
383 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
384 wrap.setText("Wrap Alignment");
385 jPanel2.add(fullScreen);
387 jPanel2.add(annotations);
388 jPanel2.add(seqLimit);
389 jPanel2.add(fontLabel);
390 jPanel2.add(smoothFont);
392 jPanel2.add(gapLabel);
393 jPanel2.add(colourLabel);
394 jPanel2.add(sortLabel);
395 jPanel2.add(startupCheckbox);
396 visualTab.add(sortby);
397 visualTab.add(gapSymbolCB);
398 visualTab.add(colour);
399 visualTab.add(fontNameCB);
400 visualTab.add(fontSizeCB);
401 visualTab.add(fontStyleCB);
402 visualTab.add(jPanel3);
403 visualTab.add(startupFileTextfield);
404 jPanel3.add(conservation);
405 jPanel3.add(identity);
406 jPanel3.add(quality);
407 visualTab.add(jPanel2);
408 linkPanel.add(editLinkButtons, BorderLayout.EAST);
409 editLinkButtons.add(newLink, null);
410 editLinkButtons.add(editLink, null);
411 editLinkButtons.add(deleteLink, null);
412 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
413 linkScrollPane.getViewport().add(linkPanel2, null);
414 linkPanel2.add(linkURLList, BorderLayout.CENTER);
415 linkPanel2.add(linkNameList, BorderLayout.WEST);
416 okCancelPanel.add(ok);
417 okCancelPanel.add(cancel);
418 this.add(tabbedPane, java.awt.BorderLayout.CENTER);
420 this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
421 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
422 , GridBagConstraints.WEST, GridBagConstraints.NONE,
423 new Insets(0, 2, 4, 0), 5, 0));
424 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
425 , GridBagConstraints.WEST,
426 GridBagConstraints.NONE,
427 new Insets(0, 0, 4, 0), 11, 6));
428 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0
429 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
430 new Insets(16, 0, 0, 12), 359, -17));
431 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
432 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
433 new Insets(21, 0, 35, 12), 4, 6));
434 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
435 , GridBagConstraints.WEST, GridBagConstraints.NONE,
436 new Insets(16, 0, 0, 0), 5, 1));
437 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
438 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
439 new Insets(0, 2, 4, 2), 54, 1));
440 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
441 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
442 new Insets(0, 2, 4, 0), 263, 1));
443 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
444 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
445 new Insets(15, 0, 0, 15), 307, 1));
448 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
449 , GridBagConstraints.WEST,
450 GridBagConstraints.NONE,
451 new Insets(0, 2, 5, 185), 2,
453 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
454 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
455 gapSymbolCB.setRenderer(dlcr);
457 tabbedPane.add(visualTab, "Visual");
458 tabbedPane.add(connectTab,"Connections");
459 tabbedPane.add(exportTab, "Output");
460 jPanel11.add(jLabel1);
462 jPanel11.add(clustaljv);
463 jPanel11.add(fastajv);
465 jPanel11.add(pfamjv);
466 jPanel11.add(pileupjv);
468 exportTab.add(modellerOutput);
469 tabbedPane.add(calcTab, "Editing");
470 calcTab.add(autoCalculateConsCheck);
471 calcTab.add(padGaps);
472 tabbedPane.add(dasPanel, "DAS Settings");
474 exportTab.add(epsLabel);
475 exportTab.add(epsRendering);
476 exportTab.add(jPanel11);
482 * @param e DOCUMENT ME!
484 public void ok_actionPerformed(ActionEvent e)
491 * @param e DOCUMENT ME!
493 public void cancel_actionPerformed(ActionEvent e)
500 * @param e DOCUMENT ME!
502 public void annotations_actionPerformed(ActionEvent e)
510 public void startupFileTextfield_mouseClicked()
515 public void newLink_actionPerformed(ActionEvent e) {
519 public void editLink_actionPerformed(ActionEvent e) {
523 public void deleteLink_actionPerformed(ActionEvent e) {
527 public void defaultBrowser_mouseClicked(MouseEvent e)
532 public void linkURLList_keyTyped(KeyEvent e)
537 public void useProxy_actionPerformed()
539 proxyServerTB.setEnabled(useProxy.isSelected());
540 proxyPortTB.setEnabled(useProxy.isSelected());