2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.0.b2)
3 * Copyright (C) 2009 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;
22 import java.awt.event.*;
24 import javax.swing.border.*;
25 import javax.swing.event.*;
26 import java.awt.Rectangle;
34 public class GPreferences extends JPanel
36 JTabbedPane tabbedPane = new JTabbedPane();
38 JButton ok = new JButton();
40 JButton cancel = new JButton();
42 JPanel okCancelPanel = new JPanel();
44 BorderLayout borderLayout1 = new BorderLayout();
46 protected JCheckBox quality = new JCheckBox();
48 JPanel visualTab = new JPanel();
50 protected JCheckBox fullScreen = new JCheckBox();
52 protected JCheckBox conservation = new JCheckBox();
54 protected JCheckBox identity = new JCheckBox();
56 protected JCheckBox annotations = new JCheckBox();
58 JLabel gapLabel = new JLabel();
60 protected JComboBox colour = new JComboBox();
62 JLabel colourLabel = new JLabel();
64 JLabel fontLabel = new JLabel();
66 protected JComboBox fontSizeCB = new JComboBox();
68 protected JComboBox fontStyleCB = new JComboBox();
70 protected JComboBox fontNameCB = new JComboBox();
72 protected JComboBox gapSymbolCB = new JComboBox();
74 protected JCheckBox startupCheckbox = new JCheckBox();
76 protected JTextField startupFileTextfield = new JTextField();
78 JPanel connectTab = new JPanel();
80 JLabel serverLabel = new JLabel();
82 protected JList linkURLList = new JList();
84 protected JTextField proxyServerTB = new JTextField();
86 protected JTextField proxyPortTB = new JTextField();
88 JLabel portLabel = new JLabel();
90 JLabel browserLabel = new JLabel();
92 protected JTextField defaultBrowser = new JTextField();
94 JButton newLink = new JButton();
96 JButton editLink = new JButton();
98 JButton deleteLink = new JButton();
100 JScrollPane linkScrollPane = new JScrollPane();
102 JPanel linkPanel = new JPanel();
104 BorderLayout borderLayout2 = new BorderLayout();
106 JPanel editLinkButtons = new JPanel();
108 GridLayout gridLayout1 = new GridLayout();
110 protected JList linkNameList = new JList();
112 JPanel linkPanel2 = new JPanel();
114 BorderLayout borderLayout3 = new BorderLayout();
116 protected JCheckBox useProxy = new JCheckBox();
118 JPanel jPanel1 = new JPanel();
120 TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
122 TitledBorder titledBorder2 = new TitledBorder("File Output");
124 GridBagLayout gridBagLayout2 = new GridBagLayout();
126 GridBagLayout gridBagLayout1 = new GridBagLayout();
128 GridBagLayout gridBagLayout3 = new GridBagLayout();
130 protected JComboBox sortby = new JComboBox();
132 JLabel sortLabel = new JLabel();
134 JPanel jPanel2 = new JPanel();
136 GridLayout gridLayout2 = new GridLayout();
138 JPanel jPanel3 = new JPanel();
140 JPanel exportTab = new JPanel();
142 JLabel epsLabel = new JLabel();
144 protected JComboBox epsRendering = new JComboBox();
146 JLabel jLabel1 = new JLabel();
148 protected JCheckBox blcjv = new JCheckBox();
150 protected JCheckBox pileupjv = new JCheckBox();
152 protected JCheckBox clustaljv = new JCheckBox();
154 protected JCheckBox msfjv = new JCheckBox();
156 protected JCheckBox fastajv = new JCheckBox();
158 protected JCheckBox pfamjv = new JCheckBox();
160 FlowLayout flowLayout1 = new FlowLayout();
162 protected JCheckBox pirjv = new JCheckBox();
164 JPanel jPanel11 = new JPanel();
166 Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);
168 protected JCheckBox seqLimit = new JCheckBox();
170 GridLayout gridLayout3 = new GridLayout();
172 protected JCheckBox smoothFont = new JCheckBox();
174 JPanel calcTab = new JPanel();
176 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
178 protected JCheckBox padGaps = new JCheckBox();
180 protected JCheckBox modellerOutput = new JCheckBox();
182 protected JPanel dasPanel = new JPanel();
184 BorderLayout borderLayout4 = new BorderLayout();
186 protected JCheckBox wrap = new JCheckBox();
188 protected JCheckBox rightAlign = new JCheckBox();
190 protected JCheckBox idItalics = new JCheckBox();
192 protected JCheckBox openoverv = new JCheckBox();
193 protected JCheckBox usagestats = new JCheckBox();
194 protected JCheckBox questionnaire = new JCheckBox();
195 protected JCheckBox versioncheck = new JCheckBox();
198 * Creates a new GPreferences object.
200 public GPreferences()
205 } catch (Exception ex)
207 ex.printStackTrace();
217 private void jbInit() throws Exception
219 this.setLayout(borderLayout1);
221 ok.addActionListener(new ActionListener()
223 public void actionPerformed(ActionEvent e)
225 ok_actionPerformed(e);
228 cancel.setText("Cancel");
229 cancel.addActionListener(new ActionListener()
231 public void actionPerformed(ActionEvent e)
233 cancel_actionPerformed(e);
236 quality.setEnabled(false);
237 quality.setFont(verdana11);
238 quality.setHorizontalAlignment(SwingConstants.RIGHT);
239 quality.setHorizontalTextPosition(SwingConstants.LEFT);
240 quality.setSelected(true);
241 quality.setText("Quality");
242 visualTab.setBorder(new TitledBorder("Open new alignment"));
243 visualTab.setLayout(null);
244 fullScreen.setFont(verdana11);
245 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
246 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
247 fullScreen.setText("Maximise Window");
248 conservation.setEnabled(false);
249 conservation.setFont(verdana11);
250 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
251 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
252 conservation.setSelected(true);
253 conservation.setText("Conservation");
254 identity.setEnabled(false);
255 identity.setFont(verdana11);
256 identity.setHorizontalAlignment(SwingConstants.RIGHT);
257 identity.setHorizontalTextPosition(SwingConstants.LEFT);
258 identity.setSelected(true);
259 identity.setText("Consensus");
260 annotations.setFont(verdana11);
261 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
262 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
263 annotations.setSelected(true);
264 annotations.setText("Show Annotations");
265 annotations.addActionListener(new ActionListener()
267 public void actionPerformed(ActionEvent e)
269 annotations_actionPerformed(e);
272 gapLabel.setFont(verdana11);
273 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
274 gapLabel.setText("Gap Symbol ");
275 colour.setFont(verdana11);
276 colour.setBounds(new Rectangle(172, 225, 155, 21));
277 colourLabel.setFont(verdana11);
278 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
279 colourLabel.setText("Colour ");
280 fontLabel.setFont(verdana11);
281 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
282 fontLabel.setText("Font ");
283 fontSizeCB.setFont(verdana11);
284 fontSizeCB.setBounds(new Rectangle(319, 111, 49, 21));
285 fontStyleCB.setFont(verdana11);
286 fontStyleCB.setBounds(new Rectangle(367, 111, 70, 21));
287 fontNameCB.setFont(verdana11);
288 fontNameCB.setBounds(new Rectangle(172, 111, 147, 21));
289 gapSymbolCB.setFont(verdana11);
290 gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21));
291 startupCheckbox.setText("Open file");
292 startupCheckbox.setFont(verdana11);
293 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
294 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
295 startupCheckbox.setSelected(true);
296 startupFileTextfield.setFont(verdana11);
297 startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));
298 startupFileTextfield.addMouseListener(new MouseAdapter()
300 public void mouseClicked(MouseEvent e)
302 if (e.getClickCount() > 1)
304 startupFileTextfield_mouseClicked();
309 connectTab.setLayout(gridBagLayout3);
310 serverLabel.setText("Address");
311 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
312 serverLabel.setFont(verdana11);
313 proxyServerTB.setFont(verdana11);
314 proxyPortTB.setFont(verdana11);
315 portLabel.setFont(verdana11);
316 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
317 portLabel.setText("Port");
318 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
319 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
320 browserLabel.setText("Default Browser (Unix)");
321 defaultBrowser.setFont(verdana11);
322 defaultBrowser.setText("");
323 usagestats.setText("Send usage statistics");
324 usagestats.setFont(verdana11);
325 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
326 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
327 questionnaire.setText("Check for questionnaires");
328 questionnaire.setFont(verdana11);
329 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
330 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
331 versioncheck.setText("Check for latest version");
332 versioncheck.setFont(verdana11);
333 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
334 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
335 newLink.setText("New");
336 newLink.addActionListener(new java.awt.event.ActionListener()
338 public void actionPerformed(ActionEvent e)
340 newLink_actionPerformed(e);
343 editLink.setText("Edit");
344 editLink.addActionListener(new java.awt.event.ActionListener()
346 public void actionPerformed(ActionEvent e)
348 editLink_actionPerformed(e);
351 deleteLink.setText("Delete");
352 deleteLink.addActionListener(new java.awt.event.ActionListener()
354 public void actionPerformed(ActionEvent e)
356 deleteLink_actionPerformed(e);
360 linkURLList.addListSelectionListener(new ListSelectionListener()
362 public void valueChanged(ListSelectionEvent e)
364 int index = linkURLList.getSelectedIndex();
365 linkNameList.setSelectedIndex(index);
369 linkNameList.addListSelectionListener(new ListSelectionListener()
371 public void valueChanged(ListSelectionEvent e)
373 int index = linkNameList.getSelectedIndex();
374 linkURLList.setSelectedIndex(index);
378 linkScrollPane.setBorder(null);
379 linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
380 linkPanel.setLayout(borderLayout2);
381 editLinkButtons.setLayout(gridLayout1);
382 gridLayout1.setRows(3);
383 linkNameList.setFont(verdana11);
384 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
385 linkPanel2.setLayout(borderLayout3);
386 linkURLList.setFont(verdana11);
387 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
389 defaultBrowser.addMouseListener(new MouseAdapter()
391 public void mouseClicked(MouseEvent e)
393 if (e.getClickCount() > 1)
395 defaultBrowser_mouseClicked(e);
399 useProxy.setFont(verdana11);
400 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
401 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
402 useProxy.setText("Use a proxy server");
403 useProxy.addActionListener(new ActionListener()
405 public void actionPerformed(ActionEvent e)
407 useProxy_actionPerformed();
410 jPanel1.setBorder(titledBorder1);
411 jPanel1.setLayout(gridBagLayout1);
412 sortby.setFont(verdana11);
413 sortby.setBounds(new Rectangle(172, 249, 155, 21));
414 sortLabel.setFont(verdana11);
415 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
416 sortLabel.setText("Sort by ");
417 jPanel2.setBounds(new Rectangle(7, 17, 158, 278));
418 jPanel2.setLayout(gridLayout2);
419 gridLayout2.setRows(12);
420 jPanel3.setBounds(new Rectangle(173, 35, 274, 26));
421 exportTab.setLayout(null);
422 epsLabel.setFont(verdana11);
423 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
424 epsLabel.setText("EPS Rendering Style");
425 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
426 epsRendering.setFont(verdana11);
427 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
428 jLabel1.setFont(verdana11);
429 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
430 jLabel1.setText("Append /start-end (/15-380)");
431 jLabel1.setFont(verdana11);
432 fastajv.setFont(verdana11);
433 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
434 clustaljv.setText("Clustal ");
435 blcjv.setText("BLC ");
436 fastajv.setText("Fasta ");
437 msfjv.setText("MSF ");
438 pfamjv.setText("PFAM ");
439 pileupjv.setText("Pileup ");
440 msfjv.setFont(verdana11);
441 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
442 pirjv.setText("PIR ");
443 jPanel11.setFont(verdana11);
444 jPanel11.setBorder(titledBorder2);
445 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
446 jPanel11.setLayout(gridLayout3);
447 blcjv.setFont(verdana11);
448 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
449 clustaljv.setFont(verdana11);
450 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
451 pfamjv.setFont(verdana11);
452 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
453 pileupjv.setFont(verdana11);
454 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
455 pirjv.setFont(verdana11);
456 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
457 seqLimit.setFont(verdana11);
458 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
459 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
460 seqLimit.setText("Full Sequence Id");
461 gridLayout3.setRows(8);
462 smoothFont.setFont(verdana11);
463 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
464 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
465 smoothFont.setText("Smooth Font");
466 calcTab.setLayout(null);
467 autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN,
469 autoCalculateConsCheck.setText("AutoCalculate Consensus");
470 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
471 padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
472 padGaps.setText("Pad gaps when editing");
473 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
474 modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
475 modellerOutput.setText("Use Modeller Output");
476 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
477 dasPanel.setLayout(borderLayout4);
478 wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
479 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
480 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
481 wrap.setText("Wrap Alignment");
482 rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
483 rightAlign.setForeground(Color.black);
484 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
485 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
486 rightAlign.setText("Right Align Ids");
487 idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
488 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
489 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
490 idItalics.setText("Sequence Name Italics");
491 openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
492 openoverv.setActionCommand("Open Overview");
493 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
494 openoverv.setHorizontalTextPosition(SwingConstants.LEADING);
495 openoverv.setText("Open Overview Window");
496 openoverv.setBounds(new Rectangle(169, 17, 200, 23));
497 jPanel2.add(fullScreen);
498 jPanel2.add(annotations);
499 jPanel2.add(seqLimit);
500 jPanel2.add(rightAlign);
501 jPanel2.add(fontLabel);
502 jPanel2.add(idItalics);
503 jPanel2.add(smoothFont);
505 jPanel2.add(gapLabel);
506 jPanel2.add(colourLabel);
507 jPanel2.add(sortLabel);
508 jPanel2.add(startupCheckbox);
509 visualTab.add(openoverv);
510 visualTab.add(startupFileTextfield);
511 visualTab.add(sortby);
512 visualTab.add(colour);
513 visualTab.add(gapSymbolCB);
514 visualTab.add(jPanel3);
515 visualTab.add(fontNameCB);
516 visualTab.add(fontSizeCB);
517 visualTab.add(fontStyleCB);
518 jPanel3.add(conservation);
519 jPanel3.add(identity);
520 jPanel3.add(quality);
521 visualTab.add(jPanel2);
522 linkPanel.add(editLinkButtons, BorderLayout.EAST);
523 editLinkButtons.add(newLink, null);
524 editLinkButtons.add(editLink, null);
525 editLinkButtons.add(deleteLink, null);
526 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
527 linkScrollPane.getViewport().add(linkPanel2, null);
528 linkPanel2.add(linkURLList, BorderLayout.CENTER);
529 linkPanel2.add(linkNameList, BorderLayout.WEST);
530 okCancelPanel.add(ok);
531 okCancelPanel.add(cancel);
532 this.add(tabbedPane, java.awt.BorderLayout.CENTER);
534 this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
535 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
536 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
538 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
539 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
541 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
542 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
543 16, 0, 0, 12), 359, -17));
544 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
545 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
546 21, 0, 35, 12), 4, 6));
547 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
548 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
549 new Insets(16, 0, 0, 0), 5, 1));
550 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
551 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
552 new Insets(0, 2, 4, 2), 54, 1));
553 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
554 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
555 new Insets(0, 2, 4, 0), 263, 1));
556 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
557 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
558 new Insets(15, 0, 0, 15), 307, 1));
559 connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0,
560 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
561 new Insets(0, 2, 4,2), 70, 1));
562 connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
563 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
564 new Insets(0, 2, 4,2), 70, 1));
565 connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
566 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
567 new Insets(0, 2, 4,2), 70, 1));
569 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
570 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
572 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
573 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
574 gapSymbolCB.setRenderer(dlcr);
576 tabbedPane.add(visualTab, "Visual");
577 tabbedPane.add(connectTab, "Connections");
578 tabbedPane.add(exportTab, "Output");
579 jPanel11.add(jLabel1);
581 jPanel11.add(clustaljv);
582 jPanel11.add(fastajv);
584 jPanel11.add(pfamjv);
585 jPanel11.add(pileupjv);
587 exportTab.add(modellerOutput);
588 tabbedPane.add(calcTab, "Editing");
589 calcTab.add(autoCalculateConsCheck);
590 calcTab.add(padGaps);
591 tabbedPane.add(dasPanel, "DAS Settings");
593 exportTab.add(epsLabel);
594 exportTab.add(epsRendering);
595 exportTab.add(jPanel11);
604 public void ok_actionPerformed(ActionEvent e)
614 public void cancel_actionPerformed(ActionEvent e)
624 public void annotations_actionPerformed(ActionEvent e)
631 public void startupFileTextfield_mouseClicked()
635 public void newLink_actionPerformed(ActionEvent e)
640 public void editLink_actionPerformed(ActionEvent e)
645 public void deleteLink_actionPerformed(ActionEvent e)
650 public void defaultBrowser_mouseClicked(MouseEvent e)
655 public void linkURLList_keyTyped(KeyEvent e)
660 public void useProxy_actionPerformed()
662 proxyServerTB.setEnabled(useProxy.isSelected());
663 proxyPortTB.setEnabled(useProxy.isSelected());