2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.gui.JvSwingUtils;
24 import jalview.gui.StructureViewer.ViewerType;
25 import jalview.jbgui.PDBDocFieldPreferences.PreferenceSource;
26 import jalview.util.MessageManager;
28 import java.awt.BorderLayout;
29 import java.awt.Color;
30 import java.awt.Component;
31 import java.awt.Dimension;
32 import java.awt.FlowLayout;
34 import java.awt.GridBagConstraints;
35 import java.awt.GridBagLayout;
36 import java.awt.GridLayout;
37 import java.awt.Insets;
38 import java.awt.Rectangle;
39 import java.awt.event.ActionEvent;
40 import java.awt.event.ActionListener;
41 import java.awt.event.FocusEvent;
42 import java.awt.event.KeyEvent;
43 import java.awt.event.MouseAdapter;
44 import java.awt.event.MouseEvent;
46 import javax.swing.BorderFactory;
47 import javax.swing.DefaultListCellRenderer;
48 import javax.swing.JButton;
49 import javax.swing.JCheckBox;
50 import javax.swing.JComboBox;
51 import javax.swing.JFileChooser;
52 import javax.swing.JLabel;
53 import javax.swing.JList;
54 import javax.swing.JPanel;
55 import javax.swing.JScrollPane;
56 import javax.swing.JTabbedPane;
57 import javax.swing.JTextField;
58 import javax.swing.ListSelectionModel;
59 import javax.swing.SwingConstants;
60 import javax.swing.border.Border;
61 import javax.swing.border.EmptyBorder;
62 import javax.swing.border.EtchedBorder;
63 import javax.swing.border.TitledBorder;
64 import javax.swing.event.ChangeEvent;
65 import javax.swing.event.ChangeListener;
66 import javax.swing.event.ListSelectionEvent;
67 import javax.swing.event.ListSelectionListener;
70 * Base class for the Preferences panel.
75 public class GPreferences extends JPanel
77 private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
79 private static final Font LABEL_FONT_ITALIC = JvSwingUtils
80 .getLabelFont(false, true);
83 * Visual tab components
85 protected JCheckBox fullScreen = new JCheckBox();
87 protected JCheckBox openoverv = new JCheckBox();
89 protected JCheckBox seqLimit = new JCheckBox();
91 protected JCheckBox rightAlign = new JCheckBox();
93 protected JComboBox<String> fontSizeCB = new JComboBox<String>();
95 protected JComboBox<String> fontStyleCB = new JComboBox<String>();
97 protected JComboBox<String> fontNameCB = new JComboBox<String>();
99 protected JCheckBox showUnconserved = new JCheckBox();
101 protected JCheckBox idItalics = new JCheckBox();
103 protected JCheckBox smoothFont = new JCheckBox();
105 protected JCheckBox scaleProteinToCdna = new JCheckBox();
107 protected JComboBox<String> gapSymbolCB = new JComboBox<String>();
109 protected JCheckBox wrap = new JCheckBox();
111 protected JComboBox<String> sortby = new JComboBox<String>();
113 protected JComboBox<String> sortAnnBy = new JComboBox<String>();
115 protected JComboBox<String> sortAutocalc = new JComboBox<String>();
117 protected JCheckBox startupCheckbox = new JCheckBox();
119 protected JTextField startupFileTextfield = new JTextField();
121 // below are in the 'second column'
122 protected JCheckBox annotations = new JCheckBox();
124 protected JCheckBox quality = new JCheckBox();
126 protected JCheckBox conservation = new JCheckBox();
128 protected JCheckBox identity = new JCheckBox();
130 protected JCheckBox showGroupConsensus = new JCheckBox();
132 protected JCheckBox showGroupConservation = new JCheckBox();
134 protected JCheckBox showConsensHistogram = new JCheckBox();
136 protected JCheckBox showConsensLogo = new JCheckBox();
138 protected JCheckBox showDbRefTooltip = new JCheckBox();
140 protected JCheckBox showNpTooltip = new JCheckBox();
143 * Structure tab and components
145 protected JPanel structureTab;
147 protected JCheckBox structFromPdb = new JCheckBox();
149 protected JCheckBox useRnaView = new JCheckBox();
151 protected JCheckBox addSecondaryStructure = new JCheckBox();
153 protected JCheckBox addTempFactor = new JCheckBox();
155 protected JComboBox<String> structViewer = new JComboBox<String>();
157 protected JTextField chimeraPath = new JTextField();
161 * Colours tab components
163 protected JPanel minColour = new JPanel();
165 protected JPanel maxColour = new JPanel();
167 protected JComboBox<String> protColour = new JComboBox<String>();
169 protected JComboBox<String> nucColour = new JComboBox<String>();
172 * Connections tab components
174 protected JList linkURLList = new JList();
176 protected JTextField proxyServerTB = new JTextField();
178 protected JTextField proxyPortTB = new JTextField();
180 protected JTextField defaultBrowser = new JTextField();
182 protected JList linkNameList = new JList();
184 protected JCheckBox useProxy = new JCheckBox();
186 protected JCheckBox usagestats = new JCheckBox();
188 protected JCheckBox questionnaire = new JCheckBox();
190 protected JCheckBox versioncheck = new JCheckBox();
193 * Output tab components
195 protected JComboBox<String> epsRendering = new JComboBox<String>();
197 protected JLabel userIdWidthlabel = new JLabel();
199 protected JCheckBox autoIdWidth = new JCheckBox();
201 protected JTextField userIdWidth = new JTextField();
203 protected JCheckBox blcjv = new JCheckBox();
205 protected JCheckBox pileupjv = new JCheckBox();
207 protected JCheckBox clustaljv = new JCheckBox();
209 protected JCheckBox msfjv = new JCheckBox();
211 protected JCheckBox fastajv = new JCheckBox();
213 protected JCheckBox pfamjv = new JCheckBox();
215 protected JCheckBox pirjv = new JCheckBox();
217 protected JCheckBox modellerOutput = new JCheckBox();
219 protected JCheckBox embbedBioJSON = new JCheckBox();
222 * Editing tab components
224 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
226 protected JCheckBox padGaps = new JCheckBox();
228 protected JCheckBox sortByTree = new JCheckBox();
233 protected JPanel dasTab = new JPanel();
238 protected JPanel wsTab = new JPanel();
241 * Creates a new GPreferences object.
243 public GPreferences()
248 } catch (Exception ex)
250 ex.printStackTrace();
255 * Construct the panel and its tabbed sub-panels.
259 private void jbInit() throws Exception
261 final JTabbedPane tabbedPane = new JTabbedPane();
262 this.setLayout(new BorderLayout());
263 JPanel okCancelPanel = initOkCancelPanel();
264 this.add(tabbedPane, BorderLayout.CENTER);
265 this.add(okCancelPanel, BorderLayout.SOUTH);
267 tabbedPane.add(initVisualTab(),
268 MessageManager.getString("label.visual"));
270 tabbedPane.add(initColoursTab(),
271 MessageManager.getString("label.colours"));
273 tabbedPane.add(initStructureTab(),
274 MessageManager.getString("label.structure"));
276 tabbedPane.add(initConnectionsTab(),
277 MessageManager.getString("label.connections"));
279 tabbedPane.add(initOutputTab(), MessageManager.getString("label.output"));
281 tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing"));
284 * See DasSourceBrowser for the real work of configuring this tab.
286 dasTab.setLayout(new BorderLayout());
288 .add(dasTab, MessageManager.getString("label.das_settings"));
291 * See WsPreferences for the real work of configuring this tab.
293 wsTab.setLayout(new BorderLayout());
294 tabbedPane.add(wsTab, MessageManager.getString("label.web_services"));
297 * Handler to validate a tab before leaving it - currently only for
300 tabbedPane.addChangeListener(new ChangeListener()
302 private Component lastTab;
305 public void stateChanged(ChangeEvent e)
307 if (lastTab == structureTab
308 && tabbedPane.getSelectedComponent() != structureTab)
310 if (!validateStructure())
312 tabbedPane.setSelectedComponent(structureTab);
316 lastTab = tabbedPane.getSelectedComponent();
323 * Initialises the Editing tabbed panel.
327 private JPanel initEditingTab()
329 JPanel editingTab = new JPanel();
330 editingTab.setLayout(null);
331 autoCalculateConsCheck.setFont(LABEL_FONT);
332 autoCalculateConsCheck.setText(MessageManager
333 .getString("label.autocalculate_consensus"));
334 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
335 padGaps.setFont(LABEL_FONT);
336 padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing"));
337 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
338 sortByTree.setFont(LABEL_FONT);
340 .setText(MessageManager.getString("label.sort_with_new_tree"));
342 .setToolTipText(MessageManager
343 .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort"));
344 sortByTree.setBounds(new Rectangle(22, 136, 168, 23));
345 editingTab.add(autoCalculateConsCheck);
346 editingTab.add(padGaps);
347 editingTab.add(sortByTree);
352 * Initialises the Output tabbed panel.
356 private JPanel initOutputTab()
358 JPanel outputTab = new JPanel();
359 outputTab.setLayout(null);
360 JLabel epsLabel = new JLabel();
361 epsLabel.setFont(LABEL_FONT);
362 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
363 epsLabel.setText(MessageManager.getString("label.eps_rendering_style"));
364 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
365 epsRendering.setFont(LABEL_FONT);
366 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
367 JLabel jLabel1 = new JLabel();
368 jLabel1.setFont(LABEL_FONT);
369 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
370 jLabel1.setText(MessageManager.getString("label.append_start_end"));
371 jLabel1.setFont(LABEL_FONT);
372 fastajv.setFont(LABEL_FONT);
373 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
374 clustaljv.setText(MessageManager.getString("label.clustal") + " ");
375 blcjv.setText(MessageManager.getString("label.blc") + " ");
376 fastajv.setText(MessageManager.getString("label.fasta") + " ");
377 msfjv.setText(MessageManager.getString("label.msf") + " ");
378 pfamjv.setText(MessageManager.getString("label.pfam") + " ");
379 pileupjv.setText(MessageManager.getString("label.pileup") + " ");
380 msfjv.setFont(LABEL_FONT);
381 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
382 pirjv.setText(MessageManager.getString("label.pir") + " ");
383 JPanel jPanel11 = new JPanel();
384 jPanel11.setFont(LABEL_FONT);
385 TitledBorder titledBorder2 = new TitledBorder(
386 MessageManager.getString("label.file_output"));
387 jPanel11.setBorder(titledBorder2);
388 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
389 GridLayout gridLayout3 = new GridLayout();
390 jPanel11.setLayout(gridLayout3);
391 gridLayout3.setRows(8);
392 blcjv.setFont(LABEL_FONT);
393 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
394 clustaljv.setFont(LABEL_FONT);
395 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
396 pfamjv.setFont(LABEL_FONT);
397 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
398 pileupjv.setFont(LABEL_FONT);
399 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
400 pirjv.setFont(LABEL_FONT);
401 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
402 autoIdWidth.setFont(LABEL_FONT);
403 autoIdWidth.setText(MessageManager
404 .getString("label.automatically_set_id_width"));
406 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.adjusts_width_generated_eps_png")));
407 autoIdWidth.setBounds(new Rectangle(228, 96, 188, 23));
408 autoIdWidth.addActionListener(new ActionListener()
412 public void actionPerformed(ActionEvent e)
414 autoIdWidth_actionPerformed();
417 userIdWidthlabel.setFont(LABEL_FONT);
418 userIdWidthlabel.setText(MessageManager
419 .getString("label.figure_id_column_width"));
421 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
423 .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager.getString("label.manually_specify_width_left_column")));
424 userIdWidthlabel.setBounds(new Rectangle(236, 120, 168, 23));
425 userIdWidth.setFont(JvSwingUtils.getTextAreaFont());
426 userIdWidth.setText("");
427 userIdWidth.setBounds(new Rectangle(232, 144, 84, 23));
428 userIdWidth.addActionListener(new ActionListener()
432 public void actionPerformed(ActionEvent e)
434 userIdWidth_actionPerformed();
437 modellerOutput.setFont(LABEL_FONT);
438 modellerOutput.setText(MessageManager
439 .getString("label.use_modeller_output"));
440 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
441 embbedBioJSON.setFont(LABEL_FONT);
442 embbedBioJSON.setText(MessageManager.getString("label.embbed_biojson"));
443 embbedBioJSON.setBounds(new Rectangle(228, 200, 250, 23));
445 jPanel11.add(jLabel1);
447 jPanel11.add(clustaljv);
448 jPanel11.add(fastajv);
450 jPanel11.add(pfamjv);
451 jPanel11.add(pileupjv);
453 outputTab.add(autoIdWidth);
454 outputTab.add(userIdWidth);
455 outputTab.add(userIdWidthlabel);
456 outputTab.add(modellerOutput);
457 outputTab.add(embbedBioJSON);
458 outputTab.add(epsLabel);
459 outputTab.add(epsRendering);
460 outputTab.add(jPanel11);
465 * Initialises the Connections tabbed panel.
469 private JPanel initConnectionsTab()
471 JPanel connectTab = new JPanel();
472 connectTab.setLayout(new GridBagLayout());
473 JLabel serverLabel = new JLabel();
474 serverLabel.setText(MessageManager.getString("label.address"));
475 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
476 serverLabel.setFont(LABEL_FONT);
477 proxyServerTB.setFont(LABEL_FONT);
478 proxyPortTB.setFont(LABEL_FONT);
479 JLabel portLabel = new JLabel();
480 portLabel.setFont(LABEL_FONT);
481 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
482 portLabel.setText(MessageManager.getString("label.port"));
483 JLabel browserLabel = new JLabel();
484 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
485 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
486 browserLabel.setText(MessageManager
487 .getString("label.default_browser_unix"));
488 defaultBrowser.setFont(LABEL_FONT);
489 defaultBrowser.setText("");
490 usagestats.setText(MessageManager
491 .getString("label.send_usage_statistics"));
492 usagestats.setFont(LABEL_FONT);
493 usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
494 usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
495 questionnaire.setText(MessageManager
496 .getString("label.check_for_questionnaires"));
497 questionnaire.setFont(LABEL_FONT);
498 questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
499 questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
500 versioncheck.setText(MessageManager
501 .getString("label.check_for_latest_version"));
502 versioncheck.setFont(LABEL_FONT);
503 versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
504 versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
505 JButton newLink = new JButton();
506 newLink.setText(MessageManager.getString("action.new"));
507 newLink.addActionListener(new java.awt.event.ActionListener()
509 public void actionPerformed(ActionEvent e)
511 newLink_actionPerformed(e);
514 JButton editLink = new JButton();
515 editLink.setText(MessageManager.getString("action.edit"));
516 editLink.addActionListener(new java.awt.event.ActionListener()
518 public void actionPerformed(ActionEvent e)
520 editLink_actionPerformed(e);
523 JButton deleteLink = new JButton();
524 deleteLink.setText(MessageManager.getString("action.delete"));
525 deleteLink.addActionListener(new java.awt.event.ActionListener()
527 public void actionPerformed(ActionEvent e)
529 deleteLink_actionPerformed(e);
533 linkURLList.addListSelectionListener(new ListSelectionListener()
535 public void valueChanged(ListSelectionEvent e)
537 int index = linkURLList.getSelectedIndex();
538 linkNameList.setSelectedIndex(index);
542 linkNameList.addListSelectionListener(new ListSelectionListener()
544 public void valueChanged(ListSelectionEvent e)
546 int index = linkNameList.getSelectedIndex();
547 linkURLList.setSelectedIndex(index);
551 JScrollPane linkScrollPane = new JScrollPane();
552 linkScrollPane.setBorder(null);
553 JPanel linkPanel = new JPanel();
554 linkPanel.setBorder(new TitledBorder(MessageManager
555 .getString("label.url_linkfrom_sequence_id")));
556 linkPanel.setLayout(new BorderLayout());
557 GridLayout gridLayout1 = new GridLayout();
558 JPanel editLinkButtons = new JPanel();
559 editLinkButtons.setLayout(gridLayout1);
560 gridLayout1.setRows(3);
561 linkNameList.setFont(LABEL_FONT);
562 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
563 BorderLayout borderLayout3 = new BorderLayout();
564 JPanel linkPanel2 = new JPanel();
565 linkPanel2.setLayout(borderLayout3);
566 linkURLList.setFont(LABEL_FONT);
567 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
569 defaultBrowser.addMouseListener(new MouseAdapter()
571 public void mouseClicked(MouseEvent e)
573 if (e.getClickCount() > 1)
575 defaultBrowser_mouseClicked(e);
579 useProxy.setFont(LABEL_FONT);
580 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
581 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
582 useProxy.setText(MessageManager.getString("label.use_proxy_server"));
583 useProxy.addActionListener(new ActionListener()
585 public void actionPerformed(ActionEvent e)
587 useProxy_actionPerformed();
590 linkPanel.add(editLinkButtons, BorderLayout.EAST);
591 editLinkButtons.add(newLink, null);
592 editLinkButtons.add(editLink, null);
593 editLinkButtons.add(deleteLink, null);
594 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
595 linkScrollPane.getViewport().add(linkPanel2, null);
596 linkPanel2.add(linkURLList, BorderLayout.CENTER);
597 linkPanel2.add(linkNameList, BorderLayout.WEST);
598 JPanel jPanel1 = new JPanel();
599 TitledBorder titledBorder1 = new TitledBorder(
600 MessageManager.getString("label.proxy_server"));
601 jPanel1.setBorder(titledBorder1);
602 jPanel1.setLayout(new GridBagLayout());
603 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
604 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
606 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
607 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
609 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
610 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
611 16, 0, 0, 12), 359, -17));
612 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0,
613 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
614 21, 0, 35, 12), 4, 6));
615 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
616 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
617 new Insets(16, 0, 0, 0), 5, 1));
618 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
619 GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
621 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0,
622 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
623 new Insets(0, 2, 4, 2), 54, 1));
624 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
625 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
626 new Insets(0, 2, 4, 0), 263, 1));
627 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
628 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
629 new Insets(15, 0, 0, 15), 307, 1));
630 connectTab.add(usagestats, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,
631 GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
632 new Insets(0, 2, 4, 2), 70, 1));
633 connectTab.add(questionnaire, new GridBagConstraints(1, 4, 1, 1, 1.0,
634 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
635 new Insets(0, 2, 4, 2), 70, 1));
636 connectTab.add(versioncheck, new GridBagConstraints(0, 5, 1, 1, 1.0,
637 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
638 new Insets(0, 2, 4, 2), 70, 1));
643 * Initialises the parent panel which contains the tabbed sections.
647 private JPanel initOkCancelPanel()
649 JButton ok = new JButton();
650 ok.setText(MessageManager.getString("action.ok"));
651 ok.addActionListener(new ActionListener()
653 public void actionPerformed(ActionEvent e)
655 ok_actionPerformed(e);
658 JButton cancel = new JButton();
659 cancel.setText(MessageManager.getString("action.cancel"));
660 cancel.addActionListener(new ActionListener()
662 public void actionPerformed(ActionEvent e)
664 cancel_actionPerformed(e);
667 JPanel okCancelPanel = new JPanel();
668 okCancelPanel.add(ok);
669 okCancelPanel.add(cancel);
670 return okCancelPanel;
674 * Initialises the Colours tabbed panel.
678 private JPanel initColoursTab()
680 JPanel coloursTab = new JPanel();
681 coloursTab.setBorder(new TitledBorder(MessageManager
682 .getString("action.open_new_alignment")));
683 coloursTab.setLayout(new FlowLayout());
684 JLabel mincolourLabel = new JLabel();
685 mincolourLabel.setFont(LABEL_FONT);
686 mincolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
687 mincolourLabel.setText(MessageManager.getString("label.min_colour"));
688 minColour.setFont(LABEL_FONT);
689 minColour.setBorder(BorderFactory.createEtchedBorder());
690 minColour.setPreferredSize(new Dimension(40, 20));
691 minColour.addMouseListener(new MouseAdapter()
693 public void mousePressed(MouseEvent e)
695 minColour_actionPerformed(minColour);
698 JLabel maxcolourLabel = new JLabel();
699 maxcolourLabel.setFont(LABEL_FONT);
700 maxcolourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
701 maxcolourLabel.setText(MessageManager.getString("label.max_colour"));
702 maxColour.setFont(LABEL_FONT);
703 maxColour.setBorder(BorderFactory.createEtchedBorder());
704 maxColour.setPreferredSize(new Dimension(40, 20));
705 maxColour.addMouseListener(new MouseAdapter()
707 public void mousePressed(MouseEvent e)
709 maxColour_actionPerformed(maxColour);
713 protColour.setFont(LABEL_FONT);
714 protColour.setBounds(new Rectangle(172, 225, 155, 21));
715 JLabel protColourLabel = new JLabel();
716 protColourLabel.setFont(LABEL_FONT);
717 protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
718 protColourLabel.setText(MessageManager
719 .getString("label.prot_alignment_colour") + " ");
720 JvSwingUtils.addtoLayout(coloursTab, MessageManager
721 .getString("label.default_colour_scheme_for_alignment"),
722 protColourLabel, protColour);
724 nucColour.setFont(LABEL_FONT);
725 nucColour.setBounds(new Rectangle(172, 240, 155, 21));
726 JLabel nucColourLabel = new JLabel();
727 nucColourLabel.setFont(LABEL_FONT);
728 nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
729 nucColourLabel.setText(MessageManager
730 .getString("label.nuc_alignment_colour")
732 JvSwingUtils.addtoLayout(coloursTab, MessageManager
733 .getString("label.default_colour_scheme_for_alignment"),
734 nucColourLabel, nucColour);
736 JPanel annotationShding = new JPanel();
737 annotationShding.setBorder(new TitledBorder(MessageManager
738 .getString("label.annotation_shading_default")));
739 annotationShding.setLayout(new GridLayout(1, 2));
740 JvSwingUtils.addtoLayout(annotationShding, MessageManager
741 .getString("label.default_minimum_colour_annotation_shading"),
742 mincolourLabel, minColour);
743 JvSwingUtils.addtoLayout(annotationShding, MessageManager
744 .getString("label.default_maximum_colour_annotation_shading"),
745 maxcolourLabel, maxColour);
746 coloursTab.add(annotationShding); // , FlowLayout.LEFT);
751 * Initialises the Structure tabbed panel.
755 private JPanel initStructureTab()
757 structureTab = new JPanel();
759 structureTab.setBorder(new TitledBorder(MessageManager
760 .getString("label.structure_options")));
761 structureTab.setLayout(null);
762 final int width = 400;
763 final int height = 22;
764 final int lineSpacing = 25;
767 structFromPdb.setFont(LABEL_FONT);
768 structFromPdb.setText(MessageManager.getString("label.struct_from_pdb"));
769 structFromPdb.setBounds(new Rectangle(5, ypos, width, height));
770 structFromPdb.addActionListener(new ActionListener()
773 public void actionPerformed(ActionEvent e)
775 boolean selected = structFromPdb.isSelected();
776 // enable other options only when the first is checked
777 useRnaView.setEnabled(selected);
778 addSecondaryStructure.setEnabled(selected);
779 addTempFactor.setEnabled(selected);
782 structureTab.add(structFromPdb);
784 // indent checkboxes that are conditional on the first one
786 useRnaView.setFont(LABEL_FONT);
787 useRnaView.setText(MessageManager.getString("label.use_rnaview"));
788 useRnaView.setBounds(new Rectangle(25, ypos, width, height));
789 structureTab.add(useRnaView);
792 addSecondaryStructure.setFont(LABEL_FONT);
793 addSecondaryStructure.setText(MessageManager
794 .getString("label.autoadd_secstr"));
795 addSecondaryStructure.setBounds(new Rectangle(25, ypos, width, height));
796 structureTab.add(addSecondaryStructure);
799 addTempFactor.setFont(LABEL_FONT);
800 addTempFactor.setText(MessageManager.getString("label.autoadd_temp"));
801 addTempFactor.setBounds(new Rectangle(25, ypos, width, height));
802 structureTab.add(addTempFactor);
805 JLabel viewerLabel = new JLabel();
806 viewerLabel.setFont(LABEL_FONT);
807 viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
808 viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
809 viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
810 structureTab.add(viewerLabel);
812 structViewer.setFont(LABEL_FONT);
813 structViewer.setBounds(new Rectangle(160, ypos, 120, height));
814 structViewer.addItem(ViewerType.JMOL.name());
815 structViewer.addItem(ViewerType.CHIMERA.name());
816 structViewer.addActionListener(new ActionListener()
819 public void actionPerformed(ActionEvent e)
821 structureViewer_actionPerformed((String) structViewer
825 structureTab.add(structViewer);
828 JLabel pathLabel = new JLabel();
829 pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
830 pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
831 pathLabel.setText(MessageManager.getString("label.chimera_path"));
832 final String tooltip = JvSwingUtils.wrapTooltip(true,
833 MessageManager.getString("label.chimera_path_tip"));
834 pathLabel.setToolTipText(tooltip);
835 pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
836 structureTab.add(pathLabel);
838 chimeraPath.setFont(LABEL_FONT);
839 chimeraPath.setText("");
840 chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
841 chimeraPath.addMouseListener(new MouseAdapter()
844 public void mouseClicked(MouseEvent e)
846 if (e.getClickCount() == 2)
848 String chosen = openFileChooser();
851 chimeraPath.setText(chosen);
856 structureTab.add(chimeraPath);
859 // scrl_pdbDocFieldConfig.setPreferredSize(new Dimension(450, 100));
860 // scrl_pdbDocFieldConfig
861 // .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
862 // scrl_pdbDocFieldConfig.setBounds();
863 PDBDocFieldPreferences docFieldPref = new PDBDocFieldPreferences(
864 PreferenceSource.PREFERENCES);
865 docFieldPref.setBounds(new Rectangle(10, ypos + 5, 450, 120));
866 structureTab.add(docFieldPref);
876 * Action on choosing a structure viewer from combobox options.
878 * @param selectedItem
880 protected void structureViewer_actionPerformed(String selectedItem)
885 * Show a dialog for the user to choose a file. Returns the chosen path, or
890 protected String openFileChooser()
892 String choice = null;
893 JFileChooser chooser = new JFileChooser();
895 // chooser.setFileView(new JalviewFileView());
896 chooser.setDialogTitle(MessageManager
897 .getString("label.open_local_file"));
898 chooser.setToolTipText(MessageManager.getString("action.open"));
900 int value = chooser.showOpenDialog(this);
902 if (value == JFileChooser.APPROVE_OPTION)
904 choice = chooser.getSelectedFile().getPath();
910 * Validate the structure tab preferences; if invalid, set focus on this tab.
914 protected boolean validateStructure(FocusEvent e)
916 if (!validateStructure())
918 e.getComponent().requestFocusInWindow();
924 protected boolean validateStructure()
930 * Initialises the Visual tabbed panel.
934 private JPanel initVisualTab()
936 JPanel visualTab = new JPanel();
937 visualTab.setBorder(new TitledBorder(MessageManager
938 .getString("action.open_new_alignment")));
939 visualTab.setLayout(null);
940 fullScreen.setFont(LABEL_FONT);
941 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
942 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
943 fullScreen.setText(MessageManager.getString("label.maximize_window"));
944 quality.setEnabled(false);
945 quality.setFont(LABEL_FONT);
946 quality.setHorizontalAlignment(SwingConstants.RIGHT);
947 quality.setHorizontalTextPosition(SwingConstants.LEFT);
948 quality.setSelected(true);
949 quality.setText(MessageManager.getString("label.quality"));
950 conservation.setEnabled(false);
951 conservation.setFont(LABEL_FONT);
952 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
953 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
954 conservation.setSelected(true);
955 conservation.setText(MessageManager.getString("label.conservation"));
956 identity.setEnabled(false);
957 identity.setFont(LABEL_FONT);
958 identity.setHorizontalAlignment(SwingConstants.RIGHT);
959 identity.setHorizontalTextPosition(SwingConstants.LEFT);
960 identity.setSelected(true);
961 identity.setText(MessageManager.getString("label.consensus"));
962 JLabel showGroupbits = new JLabel();
963 showGroupbits.setFont(LABEL_FONT);
964 showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT);
965 showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT);
966 showGroupbits.setText(MessageManager.getString("action.show_group")
968 JLabel showConsensbits = new JLabel();
969 showConsensbits.setFont(LABEL_FONT);
970 showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT);
971 showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT);
972 showConsensbits.setText(MessageManager.getString("label.consensus")
974 showConsensHistogram.setEnabled(false);
975 showConsensHistogram.setFont(LABEL_FONT);
976 showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT);
977 showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT);
978 showConsensHistogram.setSelected(true);
979 showConsensHistogram.setText(MessageManager
980 .getString("label.histogram"));
981 showConsensLogo.setEnabled(false);
982 showConsensLogo.setFont(LABEL_FONT);
983 showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT);
984 showConsensLogo.setHorizontalTextPosition(SwingConstants.LEFT);
985 showConsensLogo.setSelected(true);
986 showConsensLogo.setText(MessageManager.getString("label.logo"));
987 showGroupConsensus.setEnabled(false);
988 showGroupConsensus.setFont(LABEL_FONT);
989 showGroupConsensus.setHorizontalAlignment(SwingConstants.RIGHT);
990 showGroupConsensus.setHorizontalTextPosition(SwingConstants.LEFT);
991 showGroupConsensus.setSelected(true);
992 showGroupConsensus.setText(MessageManager.getString("label.consensus"));
993 showGroupConservation.setEnabled(false);
994 showGroupConservation.setFont(LABEL_FONT);
995 showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT);
996 showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT);
997 showGroupConservation.setSelected(true);
998 showGroupConservation.setText(MessageManager
999 .getString("label.conservation"));
1000 showNpTooltip.setEnabled(true);
1001 showNpTooltip.setFont(LABEL_FONT);
1002 showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1003 showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1004 showNpTooltip.setSelected(true);
1005 showNpTooltip.setText(MessageManager
1006 .getString("label.non_positional_features"));
1007 showDbRefTooltip.setEnabled(true);
1008 showDbRefTooltip.setFont(LABEL_FONT);
1009 showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT);
1010 showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT);
1011 showDbRefTooltip.setSelected(true);
1012 showDbRefTooltip.setText(MessageManager
1013 .getString("label.database_references"));
1014 annotations.setFont(LABEL_FONT);
1015 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
1016 annotations.setHorizontalTextPosition(SwingConstants.LEADING);
1017 annotations.setSelected(true);
1018 annotations.setText(MessageManager.getString("label.show_annotations"));
1019 annotations.setBounds(new Rectangle(169, 12, 200, 23));
1020 annotations.addActionListener(new ActionListener()
1022 public void actionPerformed(ActionEvent e)
1024 annotations_actionPerformed(e);
1027 identity.addActionListener(new ActionListener()
1029 public void actionPerformed(ActionEvent e)
1031 annotations_actionPerformed(e);
1034 showGroupConsensus.addActionListener(new ActionListener()
1036 public void actionPerformed(ActionEvent e)
1038 annotations_actionPerformed(e);
1041 showUnconserved.setFont(LABEL_FONT);
1042 showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT);
1043 showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT);
1044 showUnconserved.setSelected(true);
1045 showUnconserved.setText(MessageManager
1046 .getString("action.show_unconserved"));
1047 showUnconserved.addActionListener(new ActionListener()
1049 public void actionPerformed(ActionEvent e)
1051 showunconserved_actionPerformed(e);
1055 // TODO these are not yet added to / action from Preferences
1056 // JCheckBox shareSelections = new JCheckBox();
1057 // shareSelections.setFont(verdana11);
1058 // shareSelections.setHorizontalAlignment(SwingConstants.RIGHT);
1059 // shareSelections.setHorizontalTextPosition(SwingConstants.LEFT);
1060 // shareSelections.setSelected(true);
1061 // shareSelections.setText(MessageManager
1062 // .getString("label.share_selection_across_views"));
1063 // JCheckBox followHighlight = new JCheckBox();
1064 // followHighlight.setFont(verdana11);
1065 // followHighlight.setHorizontalAlignment(SwingConstants.RIGHT);
1066 // followHighlight.setHorizontalTextPosition(SwingConstants.LEFT);
1067 // // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23));
1068 // followHighlight.setSelected(true);
1069 // followHighlight.setText(MessageManager
1070 // .getString("label.scroll_highlighted_regions"));
1072 seqLimit.setFont(LABEL_FONT);
1073 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
1074 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
1075 seqLimit.setText(MessageManager.getString("label.full_sequence_id"));
1076 smoothFont.setFont(LABEL_FONT);
1077 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
1078 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
1079 smoothFont.setText(MessageManager.getString("label.smooth_font"));
1080 scaleProteinToCdna.setFont(LABEL_FONT);
1081 scaleProteinToCdna.setHorizontalAlignment(SwingConstants.RIGHT);
1082 scaleProteinToCdna.setHorizontalTextPosition(SwingConstants.LEADING);
1083 scaleProteinToCdna.setText(MessageManager
1084 .getString("label.scale_protein_to_cdna"));
1085 scaleProteinToCdna.setToolTipText(MessageManager
1086 .getString("label.scale_protein_to_cdna_tip"));
1087 JLabel gapLabel = new JLabel();
1088 gapLabel.setFont(LABEL_FONT);
1089 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1090 gapLabel.setText(MessageManager.getString("label.gap_symbol") + " ");
1091 JLabel fontLabel = new JLabel();
1092 fontLabel.setFont(LABEL_FONT);
1093 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1094 fontLabel.setText(MessageManager.getString("label.font"));
1095 fontSizeCB.setFont(LABEL_FONT);
1096 fontSizeCB.setBounds(new Rectangle(320, 112, 65, 23));
1097 fontStyleCB.setFont(LABEL_FONT);
1098 fontStyleCB.setBounds(new Rectangle(382, 112, 80, 23));
1099 fontNameCB.setFont(LABEL_FONT);
1100 fontNameCB.setBounds(new Rectangle(172, 112, 147, 23));
1101 gapSymbolCB.setFont(LABEL_FONT);
1102 gapSymbolCB.setBounds(new Rectangle(172, 215, 69, 23));
1103 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
1104 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
1105 gapSymbolCB.setRenderer(dlcr);
1107 startupCheckbox.setText(MessageManager.getString("action.open_file"));
1108 startupCheckbox.setFont(LABEL_FONT);
1109 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
1110 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
1111 startupCheckbox.setSelected(true);
1112 startupFileTextfield.setFont(LABEL_FONT);
1113 startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
1114 startupFileTextfield.addMouseListener(new MouseAdapter()
1116 public void mouseClicked(MouseEvent e)
1118 if (e.getClickCount() > 1)
1120 startupFileTextfield_mouseClicked();
1125 sortby.setFont(LABEL_FONT);
1126 sortby.setBounds(new Rectangle(172, 260, 155, 21));
1127 JLabel sortLabel = new JLabel();
1128 sortLabel.setFont(LABEL_FONT);
1129 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1130 sortLabel.setText(MessageManager.getString("label.sort_by"));
1131 sortAnnBy.setFont(LABEL_FONT);
1132 sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
1133 JLabel sortAnnLabel = new JLabel();
1134 sortAnnLabel.setFont(LABEL_FONT);
1135 sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
1136 sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
1137 sortAutocalc.setFont(LABEL_FONT);
1138 sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
1140 JPanel annsettingsPanel = new JPanel();
1141 annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75));
1142 annsettingsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
1143 annsettingsPanel.setBorder(new EtchedBorder());
1144 visualTab.add(annsettingsPanel);
1145 Border jb = new EmptyBorder(1, 1, 4, 5);
1146 quality.setBorder(jb);
1147 conservation.setBorder(jb);
1148 identity.setBorder(jb);
1149 showConsensbits.setBorder(jb);
1150 showGroupbits.setBorder(jb);
1151 showGroupConsensus.setBorder(jb);
1152 showGroupConservation.setBorder(jb);
1153 showConsensHistogram.setBorder(jb);
1154 showConsensLogo.setBorder(jb);
1156 JPanel autoAnnotSettings = new JPanel();
1157 autoAnnotSettings.setLayout(new GridLayout(3, 3));
1158 annsettingsPanel.add(autoAnnotSettings);
1159 autoAnnotSettings.add(quality);
1160 autoAnnotSettings.add(conservation);
1161 autoAnnotSettings.add(identity);
1162 autoAnnotSettings.add(showGroupbits);
1163 autoAnnotSettings.add(showGroupConservation);
1164 autoAnnotSettings.add(showGroupConsensus);
1165 autoAnnotSettings.add(showConsensbits);
1166 autoAnnotSettings.add(showConsensHistogram);
1167 autoAnnotSettings.add(showConsensLogo);
1169 JPanel tooltipSettings = new JPanel();
1170 tooltipSettings.setBorder(new TitledBorder(MessageManager
1171 .getString("label.sequence_id_tooltip")));
1172 tooltipSettings.setBounds(173, 140, 220, 62);
1173 tooltipSettings.setLayout(new GridLayout(2, 1));
1174 tooltipSettings.add(showDbRefTooltip);
1175 tooltipSettings.add(showNpTooltip);
1176 visualTab.add(tooltipSettings);
1178 wrap.setFont(LABEL_FONT);
1179 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
1180 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
1181 wrap.setText(MessageManager.getString("label.wrap_alignment"));
1182 rightAlign.setFont(LABEL_FONT);
1183 rightAlign.setForeground(Color.black);
1184 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
1185 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
1186 rightAlign.setText(MessageManager.getString("label.right_align_ids"));
1187 idItalics.setFont(LABEL_FONT_ITALIC);
1188 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
1189 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
1190 idItalics.setText(MessageManager
1191 .getString("label.sequence_name_italics"));
1192 openoverv.setFont(LABEL_FONT);
1193 openoverv.setActionCommand(MessageManager
1194 .getString("label.open_overview"));
1195 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
1196 openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
1197 openoverv.setText(MessageManager.getString(("label.open_overview")));
1198 JPanel jPanel2 = new JPanel();
1199 jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
1200 jPanel2.setLayout(new GridLayout(14, 1));
1201 jPanel2.add(fullScreen);
1202 jPanel2.add(openoverv);
1203 jPanel2.add(seqLimit);
1204 jPanel2.add(rightAlign);
1205 jPanel2.add(fontLabel);
1206 jPanel2.add(showUnconserved);
1207 jPanel2.add(idItalics);
1208 jPanel2.add(smoothFont);
1209 jPanel2.add(scaleProteinToCdna);
1210 jPanel2.add(gapLabel);
1212 jPanel2.add(sortLabel);
1213 jPanel2.add(sortAnnLabel);
1214 jPanel2.add(startupCheckbox);
1215 visualTab.add(jPanel2);
1216 visualTab.add(annotations);
1217 visualTab.add(startupFileTextfield);
1218 visualTab.add(sortby);
1219 visualTab.add(sortAnnBy);
1220 visualTab.add(sortAutocalc);
1221 visualTab.add(gapSymbolCB);
1222 visualTab.add(fontNameCB);
1223 visualTab.add(fontSizeCB);
1224 visualTab.add(fontStyleCB);
1228 protected void autoIdWidth_actionPerformed()
1230 // TODO Auto-generated method stub
1234 protected void userIdWidth_actionPerformed()
1236 // TODO Auto-generated method stub
1240 protected void maxColour_actionPerformed(JPanel panel)
1244 protected void minColour_actionPerformed(JPanel panel)
1248 protected void showunconserved_actionPerformed(ActionEvent e)
1250 // TODO Auto-generated method stub
1260 public void ok_actionPerformed(ActionEvent e)
1270 public void cancel_actionPerformed(ActionEvent e)
1280 public void annotations_actionPerformed(ActionEvent e)
1287 public void startupFileTextfield_mouseClicked()
1291 public void newLink_actionPerformed(ActionEvent e)
1296 public void editLink_actionPerformed(ActionEvent e)
1301 public void deleteLink_actionPerformed(ActionEvent e)
1306 public void defaultBrowser_mouseClicked(MouseEvent e)
1311 public void linkURLList_keyTyped(KeyEvent e)
1316 public void useProxy_actionPerformed()
1318 proxyServerTB.setEnabled(useProxy.isSelected());
1319 proxyPortTB.setEnabled(useProxy.isSelected());