2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 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();
195 * Creates a new GPreferences object.
197 public GPreferences()
202 } catch (Exception ex)
204 ex.printStackTrace();
214 private void jbInit() throws Exception
216 this.setLayout(borderLayout1);
218 ok.addActionListener(new ActionListener()
220 public void actionPerformed(ActionEvent e)
222 ok_actionPerformed(e);
225 cancel.setText("Cancel");
226 cancel.addActionListener(new ActionListener()
228 public void actionPerformed(ActionEvent e)
230 cancel_actionPerformed(e);
233 quality.setEnabled(false);
234 quality.setFont(verdana11);
235 quality.setHorizontalAlignment(SwingConstants.RIGHT);
236 quality.setHorizontalTextPosition(SwingConstants.LEFT);
237 quality.setSelected(true);
238 quality.setText("Quality");
239 visualTab.setBorder(new TitledBorder("Open new alignment"));
240 visualTab.setLayout(null);
241 fullScreen.setFont(verdana11);
242 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
243 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
244 fullScreen.setText("Maximise Window");
245 conservation.setEnabled(false);
246 conservation.setFont(verdana11);
247 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
248 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
249 conservation.setSelected(true);
250 conservation.setText("Conservation");
251 identity.setEnabled(false);
252 identity.setFont(verdana11);
253 identity.setHorizontalAlignment(SwingConstants.RIGHT);
254 identity.setHorizontalTextPosition(SwingConstants.LEFT);
255 identity.setSelected(true);
256 identity.setText("Consensus");
257 annotations.setFont(verdana11);
258 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
259 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
260 annotations.setSelected(true);
261 annotations.setText("Show Annotations");
262 annotations.addActionListener(new ActionListener()
264 public void actionPerformed(ActionEvent e)
266 annotations_actionPerformed(e);
269 gapLabel.setFont(verdana11);
270 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
271 gapLabel.setText("Gap Symbol ");
272 colour.setFont(verdana11);
273 colour.setBounds(new Rectangle(172, 225, 155, 21));
274 colourLabel.setFont(verdana11);
275 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
276 colourLabel.setText("Colour ");
277 fontLabel.setFont(verdana11);
278 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
279 fontLabel.setText("Font ");
280 fontSizeCB.setFont(verdana11);
281 fontSizeCB.setBounds(new Rectangle(319, 111, 49, 21));
282 fontStyleCB.setFont(verdana11);
283 fontStyleCB.setBounds(new Rectangle(367, 111, 70, 21));
284 fontNameCB.setFont(verdana11);
285 fontNameCB.setBounds(new Rectangle(172, 111, 147, 21));
286 gapSymbolCB.setFont(verdana11);
287 gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21));
288 startupCheckbox.setText("Open file");
289 startupCheckbox.setFont(verdana11);
290 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
291 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
292 startupCheckbox.setSelected(true);
293 startupFileTextfield.setFont(verdana11);
294 startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));
295 startupFileTextfield.addMouseListener(new MouseAdapter()
297 public void mouseClicked(MouseEvent e)
299 if (e.getClickCount() > 1)
301 startupFileTextfield_mouseClicked();
306 connectTab.setLayout(gridBagLayout3);
307 serverLabel.setText("Address");
308 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
309 serverLabel.setFont(verdana11);
310 proxyServerTB.setFont(verdana11);
311 proxyPortTB.setFont(verdana11);
312 portLabel.setFont(verdana11);
313 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
314 portLabel.setText("Port");
315 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
316 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
317 browserLabel.setText("Default Browser (Unix)");
318 defaultBrowser.setFont(verdana11);
319 defaultBrowser.setText("");
320 newLink.setText("New");
321 newLink.addActionListener(new java.awt.event.ActionListener()
323 public void actionPerformed(ActionEvent e)
325 newLink_actionPerformed(e);
328 editLink.setText("Edit");
329 editLink.addActionListener(new java.awt.event.ActionListener()
331 public void actionPerformed(ActionEvent e)
333 editLink_actionPerformed(e);
336 deleteLink.setText("Delete");
337 deleteLink.addActionListener(new java.awt.event.ActionListener()
339 public void actionPerformed(ActionEvent e)
341 deleteLink_actionPerformed(e);
345 linkURLList.addListSelectionListener(new ListSelectionListener()
347 public void valueChanged(ListSelectionEvent e)
349 int index = linkURLList.getSelectedIndex();
350 linkNameList.setSelectedIndex(index);
354 linkNameList.addListSelectionListener(new ListSelectionListener()
356 public void valueChanged(ListSelectionEvent e)
358 int index = linkNameList.getSelectedIndex();
359 linkURLList.setSelectedIndex(index);
363 linkScrollPane.setBorder(null);
364 linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
365 linkPanel.setLayout(borderLayout2);
366 editLinkButtons.setLayout(gridLayout1);
367 gridLayout1.setRows(3);
368 linkNameList.setFont(verdana11);
369 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
370 linkPanel2.setLayout(borderLayout3);
371 linkURLList.setFont(verdana11);
372 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
374 defaultBrowser.addMouseListener(new MouseAdapter()
376 public void mouseClicked(MouseEvent e)
378 if (e.getClickCount() > 1)
380 defaultBrowser_mouseClicked(e);
384 useProxy.setFont(verdana11);
385 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
386 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
387 useProxy.setText("Use a proxy server");
388 useProxy.addActionListener(new ActionListener()
390 public void actionPerformed(ActionEvent e)
392 useProxy_actionPerformed();
395 jPanel1.setBorder(titledBorder1);
396 jPanel1.setLayout(gridBagLayout1);
397 sortby.setFont(verdana11);
398 sortby.setBounds(new Rectangle(172, 249, 155, 21));
399 sortLabel.setFont(verdana11);
400 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
401 sortLabel.setText("Sort by ");
402 jPanel2.setBounds(new Rectangle(7, 17, 158, 278));
403 jPanel2.setLayout(gridLayout2);
404 gridLayout2.setRows(12);
405 jPanel3.setBounds(new Rectangle(173, 35, 274, 26));
406 exportTab.setLayout(null);
407 epsLabel.setFont(verdana11);
408 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
409 epsLabel.setText("EPS Rendering Style");
410 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
411 epsRendering.setFont(verdana11);
412 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
413 jLabel1.setFont(verdana11);
414 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
415 jLabel1.setText("Append /start-end (/15-380)");
416 jLabel1.setFont(verdana11);
417 fastajv.setFont(verdana11);
418 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
419 clustaljv.setText("Clustal ");
420 blcjv.setText("BLC ");
421 fastajv.setText("Fasta ");
422 msfjv.setText("MSF ");
423 pfamjv.setText("PFAM ");
424 pileupjv.setText("Pileup ");
425 msfjv.setFont(verdana11);
426 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
427 pirjv.setText("PIR ");
428 jPanel11.setFont(verdana11);
429 jPanel11.setBorder(titledBorder2);
430 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
431 jPanel11.setLayout(gridLayout3);
432 blcjv.setFont(verdana11);
433 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
434 clustaljv.setFont(verdana11);
435 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
436 pfamjv.setFont(verdana11);
437 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
438 pileupjv.setFont(verdana11);
439 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
440 pirjv.setFont(verdana11);
441 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
442 seqLimit.setFont(verdana11);
443 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
444 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
445 seqLimit.setText("Full Sequence Id");
446 gridLayout3.setRows(8);
447 smoothFont.setFont(verdana11);
448 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
449 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
450 smoothFont.setText("Smooth Font");
451 calcTab.setLayout(null);
452 autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN,
454 autoCalculateConsCheck.setText("AutoCalculate Consensus");
455 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
456 padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
457 padGaps.setText("Pad gaps when editing");
458 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
459 modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
460 modellerOutput.setText("Use Modeller Output");
461 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
462 dasPanel.setLayout(borderLayout4);
463 wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
464 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
465 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
466 wrap.setText("Wrap Alignment");
467 rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
468 rightAlign.setForeground(Color.black);
469 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
470 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
471 rightAlign.setText("Right Align Ids");
472 idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
473 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
474 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
475 idItalics.setText("Sequence Name Italics");
476 openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
477 openoverv.setActionCommand("Open Overview");
478 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
479 openoverv.setHorizontalTextPosition(SwingConstants.LEADING);
480 openoverv.setText("Open Overview Window");
481 openoverv.setBounds(new Rectangle(169, 17, 200, 23));
482 jPanel2.add(fullScreen);
483 jPanel2.add(annotations);
484 jPanel2.add(seqLimit);
485 jPanel2.add(rightAlign);
486 jPanel2.add(fontLabel);
487 jPanel2.add(idItalics);
488 jPanel2.add(smoothFont);
490 jPanel2.add(gapLabel);
491 jPanel2.add(colourLabel);
492 jPanel2.add(sortLabel);
493 jPanel2.add(startupCheckbox);
494 visualTab.add(openoverv);
495 visualTab.add(startupFileTextfield);
496 visualTab.add(sortby);
497 visualTab.add(colour);
498 visualTab.add(gapSymbolCB);
499 visualTab.add(jPanel3);
500 visualTab.add(fontNameCB);
501 visualTab.add(fontSizeCB);
502 visualTab.add(fontStyleCB);
503 jPanel3.add(conservation);
504 jPanel3.add(identity);
505 jPanel3.add(quality);
506 visualTab.add(jPanel2);
507 linkPanel.add(editLinkButtons, BorderLayout.EAST);
508 editLinkButtons.add(newLink, null);
509 editLinkButtons.add(editLink, null);
510 editLinkButtons.add(deleteLink, null);
511 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
512 linkScrollPane.getViewport().add(linkPanel2, null);
513 linkPanel2.add(linkURLList, BorderLayout.CENTER);
514 linkPanel2.add(linkNameList, BorderLayout.WEST);
515 okCancelPanel.add(ok);
516 okCancelPanel.add(cancel);
517 this.add(tabbedPane, java.awt.BorderLayout.CENTER);
519 this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
520 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
521 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
523 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
524 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
526 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
527 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
528 16, 0, 0, 12), 359, -17));
529 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
530 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
531 21, 0, 35, 12), 4, 6));
532 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
533 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
534 new Insets(16, 0, 0, 0), 5, 1));
535 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
536 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
537 new Insets(0, 2, 4, 2), 54, 1));
538 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
539 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
540 new Insets(0, 2, 4, 0), 263, 1));
541 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
542 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
543 new Insets(15, 0, 0, 15), 307, 1));
545 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
546 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
548 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
549 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
550 gapSymbolCB.setRenderer(dlcr);
552 tabbedPane.add(visualTab, "Visual");
553 tabbedPane.add(connectTab, "Connections");
554 tabbedPane.add(exportTab, "Output");
555 jPanel11.add(jLabel1);
557 jPanel11.add(clustaljv);
558 jPanel11.add(fastajv);
560 jPanel11.add(pfamjv);
561 jPanel11.add(pileupjv);
563 exportTab.add(modellerOutput);
564 tabbedPane.add(calcTab, "Editing");
565 calcTab.add(autoCalculateConsCheck);
566 calcTab.add(padGaps);
567 tabbedPane.add(dasPanel, "DAS Settings");
569 exportTab.add(epsLabel);
570 exportTab.add(epsRendering);
571 exportTab.add(jPanel11);
580 public void ok_actionPerformed(ActionEvent e)
590 public void cancel_actionPerformed(ActionEvent e)
600 public void annotations_actionPerformed(ActionEvent e)
607 public void startupFileTextfield_mouseClicked()
611 public void newLink_actionPerformed(ActionEvent e)
616 public void editLink_actionPerformed(ActionEvent e)
621 public void deleteLink_actionPerformed(ActionEvent e)
626 public void defaultBrowser_mouseClicked(MouseEvent e)
631 public void linkURLList_keyTyped(KeyEvent e)
636 public void useProxy_actionPerformed()
638 proxyServerTB.setEnabled(useProxy.isSelected());
639 proxyPortTB.setEnabled(useProxy.isSelected());