2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
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.*;
25 import javax.swing.border.*;
26 import javax.swing.event.*;
27 import java.awt.Rectangle;
35 public class GPreferences extends JPanel
37 JTabbedPane tabbedPane = new JTabbedPane();
39 JButton ok = new JButton();
41 JButton cancel = new JButton();
43 JPanel okCancelPanel = new JPanel();
45 BorderLayout borderLayout1 = new BorderLayout();
47 protected JCheckBox quality = new JCheckBox();
49 JPanel visualTab = new JPanel();
51 protected JCheckBox fullScreen = new JCheckBox();
53 protected JCheckBox conservation = new JCheckBox();
55 protected JCheckBox identity = new JCheckBox();
57 protected JCheckBox annotations = new JCheckBox();
59 JLabel gapLabel = new JLabel();
61 protected JComboBox colour = new JComboBox();
63 JLabel colourLabel = new JLabel();
65 JLabel fontLabel = new JLabel();
67 protected JComboBox fontSizeCB = new JComboBox();
69 protected JComboBox fontStyleCB = new JComboBox();
71 protected JComboBox fontNameCB = new JComboBox();
73 protected JComboBox gapSymbolCB = new JComboBox();
75 protected JCheckBox startupCheckbox = new JCheckBox();
77 protected JTextField startupFileTextfield = new JTextField();
79 JPanel connectTab = new JPanel();
81 JLabel serverLabel = new JLabel();
83 protected JList linkURLList = new JList();
85 protected JTextField proxyServerTB = new JTextField();
87 protected JTextField proxyPortTB = new JTextField();
89 JLabel portLabel = new JLabel();
91 JLabel browserLabel = new JLabel();
93 protected JTextField defaultBrowser = new JTextField();
95 JButton newLink = new JButton();
97 JButton editLink = new JButton();
99 JButton deleteLink = new JButton();
101 JScrollPane linkScrollPane = new JScrollPane();
103 JPanel linkPanel = new JPanel();
105 BorderLayout borderLayout2 = new BorderLayout();
107 JPanel editLinkButtons = new JPanel();
109 GridLayout gridLayout1 = new GridLayout();
111 protected JList linkNameList = new JList();
113 JPanel linkPanel2 = new JPanel();
115 BorderLayout borderLayout3 = new BorderLayout();
117 protected JCheckBox useProxy = new JCheckBox();
119 JPanel jPanel1 = new JPanel();
121 TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
123 TitledBorder titledBorder2 = new TitledBorder("File Output");
125 GridBagLayout gridBagLayout2 = new GridBagLayout();
127 GridBagLayout gridBagLayout1 = new GridBagLayout();
129 GridBagLayout gridBagLayout3 = new GridBagLayout();
131 protected JComboBox sortby = new JComboBox();
133 JLabel sortLabel = new JLabel();
135 JPanel jPanel2 = new JPanel();
137 GridLayout gridLayout2 = new GridLayout();
139 JPanel jPanel3 = new JPanel();
141 JPanel exportTab = new JPanel();
143 JLabel epsLabel = new JLabel();
145 protected JComboBox epsRendering = new JComboBox();
147 JLabel jLabel1 = new JLabel();
149 protected JCheckBox blcjv = new JCheckBox();
151 protected JCheckBox pileupjv = new JCheckBox();
153 protected JCheckBox clustaljv = new JCheckBox();
155 protected JCheckBox msfjv = new JCheckBox();
157 protected JCheckBox fastajv = new JCheckBox();
159 protected JCheckBox pfamjv = new JCheckBox();
161 FlowLayout flowLayout1 = new FlowLayout();
163 protected JCheckBox pirjv = new JCheckBox();
165 JPanel jPanel11 = new JPanel();
167 Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);
169 protected JCheckBox seqLimit = new JCheckBox();
171 GridLayout gridLayout3 = new GridLayout();
173 protected JCheckBox smoothFont = new JCheckBox();
175 JPanel calcTab = new JPanel();
177 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
179 protected JCheckBox padGaps = new JCheckBox();
181 protected JCheckBox modellerOutput = new JCheckBox();
183 protected JPanel dasPanel = new JPanel();
185 BorderLayout borderLayout4 = new BorderLayout();
187 protected JCheckBox wrap = new JCheckBox();
189 protected JCheckBox rightAlign = new JCheckBox();
191 protected JCheckBox showUnconserved = new JCheckBox();
193 protected JCheckBox idItalics = new JCheckBox();
195 protected JCheckBox openoverv = 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 showUnconserved.setFont(verdana11);
273 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
274 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
275 //showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
276 showUnconserved.setSelected(true);
277 showUnconserved.setText("Show Unconserved");
278 showUnconserved.addActionListener(new ActionListener()
280 public void actionPerformed(ActionEvent e)
282 showunconserved_actionPerformed(e);
286 gapLabel.setFont(verdana11);
287 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
288 gapLabel.setText("Gap Symbol ");
289 colour.setFont(verdana11);
290 colour.setBounds(new Rectangle(172, 225, 155, 21));
291 colourLabel.setFont(verdana11);
292 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
293 colourLabel.setText("Colour ");
294 fontLabel.setFont(verdana11);
295 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
296 fontLabel.setText("Font ");
297 fontSizeCB.setFont(verdana11);
298 fontSizeCB.setBounds(new Rectangle(319, 101, 49, 21));
299 fontStyleCB.setFont(verdana11);
300 fontStyleCB.setBounds(new Rectangle(367, 101, 70, 21));
301 fontNameCB.setFont(verdana11);
302 fontNameCB.setBounds(new Rectangle(172, 101, 147, 21));
303 gapSymbolCB.setFont(verdana11);
304 gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21));
305 startupCheckbox.setText("Open file");
306 startupCheckbox.setFont(verdana11);
307 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
308 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
309 startupCheckbox.setSelected(true);
310 startupFileTextfield.setFont(verdana11);
311 startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));
312 startupFileTextfield.addMouseListener(new MouseAdapter()
314 public void mouseClicked(MouseEvent e)
316 if (e.getClickCount() > 1)
318 startupFileTextfield_mouseClicked();
323 connectTab.setLayout(gridBagLayout3);
324 serverLabel.setText("Address");
325 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
326 serverLabel.setFont(verdana11);
327 proxyServerTB.setFont(verdana11);
328 proxyPortTB.setFont(verdana11);
329 portLabel.setFont(verdana11);
330 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
331 portLabel.setText("Port");
332 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
333 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
334 browserLabel.setText("Default Browser (Unix)");
335 defaultBrowser.setFont(verdana11);
336 defaultBrowser.setText("");
337 newLink.setText("New");
338 newLink.addActionListener(new java.awt.event.ActionListener()
340 public void actionPerformed(ActionEvent e)
342 newLink_actionPerformed(e);
345 editLink.setText("Edit");
346 editLink.addActionListener(new java.awt.event.ActionListener()
348 public void actionPerformed(ActionEvent e)
350 editLink_actionPerformed(e);
353 deleteLink.setText("Delete");
354 deleteLink.addActionListener(new java.awt.event.ActionListener()
356 public void actionPerformed(ActionEvent e)
358 deleteLink_actionPerformed(e);
362 linkURLList.addListSelectionListener(new ListSelectionListener()
364 public void valueChanged(ListSelectionEvent e)
366 int index = linkURLList.getSelectedIndex();
367 linkNameList.setSelectedIndex(index);
371 linkNameList.addListSelectionListener(new ListSelectionListener()
373 public void valueChanged(ListSelectionEvent e)
375 int index = linkNameList.getSelectedIndex();
376 linkURLList.setSelectedIndex(index);
380 linkScrollPane.setBorder(null);
381 linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
382 linkPanel.setLayout(borderLayout2);
383 editLinkButtons.setLayout(gridLayout1);
384 gridLayout1.setRows(3);
385 linkNameList.setFont(verdana11);
386 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
387 linkPanel2.setLayout(borderLayout3);
388 linkURLList.setFont(verdana11);
389 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
391 defaultBrowser.addMouseListener(new MouseAdapter()
393 public void mouseClicked(MouseEvent e)
395 if (e.getClickCount() > 1)
397 defaultBrowser_mouseClicked(e);
401 useProxy.setFont(verdana11);
402 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
403 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
404 useProxy.setText("Use a proxy server");
405 useProxy.addActionListener(new ActionListener()
407 public void actionPerformed(ActionEvent e)
409 useProxy_actionPerformed();
412 jPanel1.setBorder(titledBorder1);
413 jPanel1.setLayout(gridBagLayout1);
414 sortby.setFont(verdana11);
415 sortby.setBounds(new Rectangle(172, 249, 155, 21));
416 sortLabel.setFont(verdana11);
417 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
418 sortLabel.setText("Sort by ");
419 jPanel2.setBounds(new Rectangle(7, 17, 158, 278));
420 jPanel2.setLayout(gridLayout2);
421 gridLayout2.setRows(13);
422 jPanel3.setBounds(new Rectangle(173, 35, 274, 26));
423 exportTab.setLayout(null);
424 epsLabel.setFont(verdana11);
425 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
426 epsLabel.setText("EPS Rendering Style");
427 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
428 epsRendering.setFont(verdana11);
429 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
430 jLabel1.setFont(verdana11);
431 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
432 jLabel1.setText("Append /start-end (/15-380)");
433 jLabel1.setFont(verdana11);
434 fastajv.setFont(verdana11);
435 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
436 clustaljv.setText("Clustal ");
437 blcjv.setText("BLC ");
438 fastajv.setText("Fasta ");
439 msfjv.setText("MSF ");
440 pfamjv.setText("PFAM ");
441 pileupjv.setText("Pileup ");
442 msfjv.setFont(verdana11);
443 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
444 pirjv.setText("PIR ");
445 jPanel11.setFont(verdana11);
446 jPanel11.setBorder(titledBorder2);
447 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
448 jPanel11.setLayout(gridLayout3);
449 blcjv.setFont(verdana11);
450 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
451 clustaljv.setFont(verdana11);
452 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
453 pfamjv.setFont(verdana11);
454 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
455 pileupjv.setFont(verdana11);
456 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
457 pirjv.setFont(verdana11);
458 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
459 seqLimit.setFont(verdana11);
460 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
461 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
462 seqLimit.setText("Full Sequence Id");
463 gridLayout3.setRows(8);
464 smoothFont.setFont(verdana11);
465 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
466 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
467 smoothFont.setText("Smooth Font");
468 calcTab.setLayout(null);
469 autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN,
471 autoCalculateConsCheck.setText("AutoCalculate Consensus");
472 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
473 padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
474 padGaps.setText("Pad gaps when editing");
475 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
476 modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
477 modellerOutput.setText("Use Modeller Output");
478 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
479 dasPanel.setLayout(borderLayout4);
480 wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
481 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
482 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
483 wrap.setText("Wrap Alignment");
484 rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
485 rightAlign.setForeground(Color.black);
486 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
487 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
488 rightAlign.setText("Right Align Ids");
489 idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
490 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
491 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
492 idItalics.setText("Sequence Name Italics");
493 openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
494 openoverv.setActionCommand("Open Overview");
495 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
496 openoverv.setHorizontalTextPosition(SwingConstants.LEADING);
497 openoverv.setText("Open Overview Window");
498 openoverv.setBounds(new Rectangle(169, 17, 200, 23));
499 jPanel2.add(fullScreen);
500 jPanel2.add(annotations);
501 jPanel2.add(seqLimit);
502 jPanel2.add(rightAlign);
503 jPanel2.add(fontLabel);
504 jPanel2.add(showUnconserved);
505 jPanel2.add(idItalics);
506 jPanel2.add(smoothFont);
508 jPanel2.add(gapLabel);
509 jPanel2.add(colourLabel);
510 jPanel2.add(sortLabel);
511 jPanel2.add(startupCheckbox);
512 visualTab.add(openoverv);
513 visualTab.add(startupFileTextfield);
514 visualTab.add(sortby);
515 visualTab.add(colour);
516 visualTab.add(gapSymbolCB);
517 visualTab.add(jPanel3);
518 visualTab.add(fontNameCB);
519 visualTab.add(fontSizeCB);
520 visualTab.add(fontStyleCB);
521 jPanel3.add(conservation);
522 jPanel3.add(identity);
523 jPanel3.add(quality);
524 visualTab.add(jPanel2);
526 linkPanel.add(editLinkButtons, BorderLayout.EAST);
527 editLinkButtons.add(newLink, null);
528 editLinkButtons.add(editLink, null);
529 editLinkButtons.add(deleteLink, null);
530 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
531 linkScrollPane.getViewport().add(linkPanel2, null);
532 linkPanel2.add(linkURLList, BorderLayout.CENTER);
533 linkPanel2.add(linkNameList, BorderLayout.WEST);
534 okCancelPanel.add(ok);
535 okCancelPanel.add(cancel);
536 this.add(tabbedPane, java.awt.BorderLayout.CENTER);
538 this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
539 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
540 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
542 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
543 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
545 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
546 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
547 16, 0, 0, 12), 359, -17));
548 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
549 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
550 21, 0, 35, 12), 4, 6));
551 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
552 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
553 new Insets(16, 0, 0, 0), 5, 1));
554 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
555 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
556 new Insets(0, 2, 4, 2), 54, 1));
557 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
558 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
559 new Insets(0, 2, 4, 0), 263, 1));
560 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
561 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
562 new Insets(15, 0, 0, 15), 307, 1));
564 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
565 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
567 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
568 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
569 gapSymbolCB.setRenderer(dlcr);
571 tabbedPane.add(visualTab, "Visual");
572 tabbedPane.add(connectTab, "Connections");
573 tabbedPane.add(exportTab, "Output");
574 jPanel11.add(jLabel1);
576 jPanel11.add(clustaljv);
577 jPanel11.add(fastajv);
579 jPanel11.add(pfamjv);
580 jPanel11.add(pileupjv);
582 exportTab.add(modellerOutput);
583 tabbedPane.add(calcTab, "Editing");
584 calcTab.add(autoCalculateConsCheck);
585 calcTab.add(padGaps);
586 tabbedPane.add(dasPanel, "DAS Settings");
588 exportTab.add(epsLabel);
589 exportTab.add(epsRendering);
590 exportTab.add(jPanel11);
593 protected void showunconserved_actionPerformed(ActionEvent e)
595 // TODO Auto-generated method stub
605 public void ok_actionPerformed(ActionEvent e)
615 public void cancel_actionPerformed(ActionEvent e)
625 public void annotations_actionPerformed(ActionEvent e)
632 public void startupFileTextfield_mouseClicked()
636 public void newLink_actionPerformed(ActionEvent e)
641 public void editLink_actionPerformed(ActionEvent e)
646 public void deleteLink_actionPerformed(ActionEvent e)
651 public void defaultBrowser_mouseClicked(MouseEvent e)
656 public void linkURLList_keyTyped(KeyEvent e)
661 public void useProxy_actionPerformed()
663 proxyServerTB.setEnabled(useProxy.isSelected());
664 proxyPortTB.setEnabled(useProxy.isSelected());