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
37 JTabbedPane tabbedPane = new JTabbedPane();
39 JButton ok = new JButton();
40 JButton cancel = new JButton();
41 JPanel okCancelPanel = new JPanel();
42 BorderLayout borderLayout1 = new BorderLayout();
43 protected JCheckBox quality = new JCheckBox();
44 JPanel visualTab = new JPanel();
45 protected JCheckBox fullScreen = new JCheckBox();
46 protected JCheckBox conservation = new JCheckBox();
47 protected JCheckBox identity = new JCheckBox();
48 protected JCheckBox annotations = new JCheckBox();
49 JLabel gapLabel = new JLabel();
50 protected JComboBox colour = new JComboBox();
51 JLabel colourLabel = new JLabel();
52 JLabel fontLabel = new JLabel();
53 protected JComboBox fontSizeCB = new JComboBox();
54 protected JComboBox fontStyleCB = new JComboBox();
55 protected JComboBox fontNameCB = new JComboBox();
56 protected JComboBox gapSymbolCB = new JComboBox();
57 protected JCheckBox startupCheckbox = new JCheckBox();
58 protected JTextField startupFileTextfield = new JTextField();
59 JPanel connectTab = new JPanel();
60 JLabel serverLabel = new JLabel();
61 protected JList linkURLList = new JList();
62 protected JTextField proxyServerTB = new JTextField();
63 protected JTextField proxyPortTB = new JTextField();
64 JLabel portLabel = new JLabel();
65 JLabel browserLabel = new JLabel();
66 protected JTextField defaultBrowser = new JTextField();
67 JButton newLink = new JButton();
68 JButton editLink = new JButton();
69 JButton deleteLink = new JButton();
70 JScrollPane linkScrollPane = new JScrollPane();
71 JPanel linkPanel = new JPanel();
72 BorderLayout borderLayout2 = new BorderLayout();
73 JPanel editLinkButtons = new JPanel();
74 GridLayout gridLayout1 = new GridLayout();
75 protected JList linkNameList = new JList();
76 JPanel linkPanel2 = new JPanel();
77 BorderLayout borderLayout3 = new BorderLayout();
78 protected JCheckBox useProxy = new JCheckBox();
79 JPanel jPanel1 = new JPanel();
80 TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
81 TitledBorder titledBorder2 = new TitledBorder("File Output");
82 GridBagLayout gridBagLayout2 = new GridBagLayout();
83 GridBagLayout gridBagLayout1 = new GridBagLayout();
84 GridBagLayout gridBagLayout3 = new GridBagLayout();
85 protected JComboBox sortby = new JComboBox();
86 JLabel sortLabel = new JLabel();
87 JPanel jPanel2 = new JPanel();
88 GridLayout gridLayout2 = new GridLayout();
89 JPanel jPanel3 = new JPanel();
90 JPanel exportTab = new JPanel();
91 JLabel epsLabel = new JLabel();
92 protected JComboBox epsRendering = new JComboBox();
93 JLabel jLabel1 = new JLabel();
94 protected JCheckBox blcjv = new JCheckBox();
95 protected JCheckBox pileupjv = new JCheckBox();
96 protected JCheckBox clustaljv = new JCheckBox();
97 protected JCheckBox msfjv = new JCheckBox();
98 protected JCheckBox fastajv = new JCheckBox();
99 protected JCheckBox pfamjv = new JCheckBox();
100 FlowLayout flowLayout1 = new FlowLayout();
101 protected JCheckBox pirjv = new JCheckBox();
102 JPanel jPanel11 = new JPanel();
103 Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);
104 protected JCheckBox seqLimit = new JCheckBox();
105 GridLayout gridLayout3 = new GridLayout();
106 protected JCheckBox smoothFont = new JCheckBox();
107 JPanel calcTab = new JPanel();
108 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
109 protected JCheckBox padGaps = new JCheckBox();
110 protected JCheckBox modellerOutput = new JCheckBox();
111 protected JPanel dasPanel = new JPanel();
112 BorderLayout borderLayout4 = new BorderLayout();
113 protected JCheckBox wrap = new JCheckBox();
114 protected JCheckBox rightAlign = new JCheckBox();
115 protected JCheckBox idItalics = new JCheckBox();
116 protected JCheckBox openoverv = new JCheckBox();
118 * Creates a new GPreferences object.
120 public GPreferences()
128 ex.printStackTrace();
135 * @throws Exception DOCUMENT ME!
137 private void jbInit()
140 this.setLayout(borderLayout1);
142 ok.addActionListener(new ActionListener()
144 public void actionPerformed(ActionEvent e)
146 ok_actionPerformed(e);
149 cancel.setText("Cancel");
150 cancel.addActionListener(new ActionListener()
152 public void actionPerformed(ActionEvent e)
154 cancel_actionPerformed(e);
157 quality.setEnabled(false);
158 quality.setFont(verdana11);
159 quality.setHorizontalAlignment(SwingConstants.RIGHT);
160 quality.setHorizontalTextPosition(SwingConstants.LEFT);
161 quality.setSelected(true);
162 quality.setText("Quality");
163 visualTab.setBorder(new TitledBorder("Open new alignment"));
164 visualTab.setLayout(null);
165 fullScreen.setFont(verdana11);
166 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
167 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
168 fullScreen.setText("Maximise Window");
169 conservation.setEnabled(false);
170 conservation.setFont(verdana11);
171 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
172 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
173 conservation.setSelected(true);
174 conservation.setText("Conservation");
175 identity.setEnabled(false);
176 identity.setFont(verdana11);
177 identity.setHorizontalAlignment(SwingConstants.RIGHT);
178 identity.setHorizontalTextPosition(SwingConstants.LEFT);
179 identity.setSelected(true);
180 identity.setText("Consensus");
181 annotations.setFont(verdana11);
182 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
183 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
184 annotations.setSelected(true);
185 annotations.setText("Show Annotations");
186 annotations.addActionListener(new ActionListener()
188 public void actionPerformed(ActionEvent e)
190 annotations_actionPerformed(e);
193 gapLabel.setFont(verdana11);
194 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
195 gapLabel.setText("Gap Symbol ");
196 colour.setFont(verdana11);
197 colour.setBounds(new Rectangle(172, 225, 155, 21));
198 colourLabel.setFont(verdana11);
199 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
200 colourLabel.setText("Colour ");
201 fontLabel.setFont(verdana11);
202 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
203 fontLabel.setText("Font ");
204 fontSizeCB.setFont(verdana11);
205 fontSizeCB.setBounds(new Rectangle(319, 111, 49, 21));
206 fontStyleCB.setFont(verdana11);
207 fontStyleCB.setBounds(new Rectangle(367, 111, 70, 21));
208 fontNameCB.setFont(verdana11);
209 fontNameCB.setBounds(new Rectangle(172, 111, 147, 21));
210 gapSymbolCB.setFont(verdana11);
211 gapSymbolCB.setBounds(new Rectangle(172, 204, 69, 21));
212 startupCheckbox.setText("Open file");
213 startupCheckbox.setFont(verdana11);
214 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
215 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
216 startupCheckbox.setSelected(true);
217 startupFileTextfield.setFont(verdana11);
218 startupFileTextfield.setBounds(new Rectangle(172, 273, 270, 20));
219 startupFileTextfield.addMouseListener(new MouseAdapter()
221 public void mouseClicked(MouseEvent e)
223 if (e.getClickCount() > 1)
225 startupFileTextfield_mouseClicked();
230 connectTab.setLayout(gridBagLayout3);
231 serverLabel.setText("Address");
232 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
233 serverLabel.setFont(verdana11);
234 proxyServerTB.setFont(verdana11);
235 proxyPortTB.setFont(verdana11);
236 portLabel.setFont(verdana11);
237 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
238 portLabel.setText("Port");
239 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
240 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
241 browserLabel.setText("Default Browser (Unix)");
242 defaultBrowser.setFont(verdana11);
243 defaultBrowser.setText("");
244 newLink.setText("New");
245 newLink.addActionListener(new java.awt.event.ActionListener()
247 public void actionPerformed(ActionEvent e)
249 newLink_actionPerformed(e);
252 editLink.setText("Edit");
253 editLink.addActionListener(new java.awt.event.ActionListener()
255 public void actionPerformed(ActionEvent e)
257 editLink_actionPerformed(e);
260 deleteLink.setText("Delete");
261 deleteLink.addActionListener(new java.awt.event.ActionListener()
263 public void actionPerformed(ActionEvent e)
265 deleteLink_actionPerformed(e);
269 linkURLList.addListSelectionListener(new ListSelectionListener()
271 public void valueChanged(ListSelectionEvent e)
273 int index = linkURLList.getSelectedIndex();
274 linkNameList.setSelectedIndex(index);
278 linkNameList.addListSelectionListener(new ListSelectionListener()
280 public void valueChanged(ListSelectionEvent e)
282 int index = linkNameList.getSelectedIndex();
283 linkURLList.setSelectedIndex(index);
287 linkScrollPane.setBorder(null);
288 linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
289 linkPanel.setLayout(borderLayout2);
290 editLinkButtons.setLayout(gridLayout1);
291 gridLayout1.setRows(3);
292 linkNameList.setFont(verdana11);
293 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
294 linkPanel2.setLayout(borderLayout3);
295 linkURLList.setFont(verdana11);
296 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
298 defaultBrowser.addMouseListener(new MouseAdapter()
300 public void mouseClicked(MouseEvent e)
302 if (e.getClickCount() > 1)
304 defaultBrowser_mouseClicked(e);
308 useProxy.setFont(verdana11);
309 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
310 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
311 useProxy.setText("Use a proxy server");
312 useProxy.addActionListener(new ActionListener()
314 public void actionPerformed(ActionEvent e)
316 useProxy_actionPerformed();
319 jPanel1.setBorder(titledBorder1);
320 jPanel1.setLayout(gridBagLayout1);
321 sortby.setFont(verdana11);
322 sortby.setBounds(new Rectangle(172, 249, 155, 21));
323 sortLabel.setFont(verdana11);
324 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
325 sortLabel.setText("Sort by ");
326 jPanel2.setBounds(new Rectangle(7, 17, 158, 278));
327 jPanel2.setLayout(gridLayout2);
328 gridLayout2.setRows(12);
329 jPanel3.setBounds(new Rectangle(173, 35, 274, 26));
330 exportTab.setLayout(null);
331 epsLabel.setFont(verdana11);
332 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
333 epsLabel.setText("EPS Rendering Style");
334 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
335 epsRendering.setFont(verdana11);
336 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
337 jLabel1.setFont(verdana11);
338 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
339 jLabel1.setText("Append /start-end (/15-380)");
340 jLabel1.setFont(verdana11);
341 fastajv.setFont(verdana11);
342 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
343 clustaljv.setText("Clustal ");
344 blcjv.setText("BLC ");
345 fastajv.setText("Fasta ");
346 msfjv.setText("MSF ");
347 pfamjv.setText("PFAM ");
348 pileupjv.setText("Pileup ");
349 msfjv.setFont(verdana11);
350 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
351 pirjv.setText("PIR ");
352 jPanel11.setFont(verdana11);
353 jPanel11.setBorder(titledBorder2);
354 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
355 jPanel11.setLayout(gridLayout3);
356 blcjv.setFont(verdana11);
357 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
358 clustaljv.setFont(verdana11);
359 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
360 pfamjv.setFont(verdana11);
361 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
362 pileupjv.setFont(verdana11);
363 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
364 pirjv.setFont(verdana11);
365 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
366 seqLimit.setFont(verdana11);
367 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
368 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
369 seqLimit.setText("Full Sequence Id");
370 gridLayout3.setRows(8);
371 smoothFont.setFont(verdana11);
372 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
373 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
374 smoothFont.setText("Smooth Font");
375 calcTab.setLayout(null);
376 autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
377 autoCalculateConsCheck.setText("AutoCalculate Consensus");
378 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
379 padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
380 padGaps.setText("Pad gaps when editing");
381 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
382 modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
383 modellerOutput.setText("Use Modeller Output");
384 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
385 dasPanel.setLayout(borderLayout4);
386 wrap.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
387 wrap.setHorizontalAlignment(SwingConstants.TRAILING);
388 wrap.setHorizontalTextPosition(SwingConstants.LEADING);
389 wrap.setText("Wrap Alignment");
390 rightAlign.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
391 rightAlign.setForeground(Color.black);
392 rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
393 rightAlign.setHorizontalTextPosition(SwingConstants.LEFT);
394 rightAlign.setText("Right Align Ids");
395 idItalics.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
396 idItalics.setHorizontalAlignment(SwingConstants.RIGHT);
397 idItalics.setHorizontalTextPosition(SwingConstants.LEADING);
398 idItalics.setText("Sequence Name Italics");
399 openoverv.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
400 openoverv.setActionCommand("Open Overview");
401 openoverv.setHorizontalAlignment(SwingConstants.RIGHT);
402 openoverv.setHorizontalTextPosition(SwingConstants.LEADING);
403 openoverv.setText("Open Overview Window");
404 openoverv.setBounds(new Rectangle(169, 17, 200, 23));
405 jPanel2.add(fullScreen);
406 jPanel2.add(annotations);
407 jPanel2.add(seqLimit);
408 jPanel2.add(rightAlign);
409 jPanel2.add(fontLabel);
410 jPanel2.add(idItalics);
411 jPanel2.add(smoothFont);
413 jPanel2.add(gapLabel);
414 jPanel2.add(colourLabel);
415 jPanel2.add(sortLabel);
416 jPanel2.add(startupCheckbox);
417 visualTab.add(openoverv);
418 visualTab.add(startupFileTextfield);
419 visualTab.add(sortby);
420 visualTab.add(colour);
421 visualTab.add(gapSymbolCB);
422 visualTab.add(jPanel3);
423 visualTab.add(fontNameCB);
424 visualTab.add(fontSizeCB);
425 visualTab.add(fontStyleCB);
426 jPanel3.add(conservation);
427 jPanel3.add(identity);
428 jPanel3.add(quality);
429 visualTab.add(jPanel2);
430 linkPanel.add(editLinkButtons, BorderLayout.EAST);
431 editLinkButtons.add(newLink, null);
432 editLinkButtons.add(editLink, null);
433 editLinkButtons.add(deleteLink, null);
434 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
435 linkScrollPane.getViewport().add(linkPanel2, null);
436 linkPanel2.add(linkURLList, BorderLayout.CENTER);
437 linkPanel2.add(linkNameList, BorderLayout.WEST);
438 okCancelPanel.add(ok);
439 okCancelPanel.add(cancel);
440 this.add(tabbedPane, java.awt.BorderLayout.CENTER);
442 this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
443 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
444 , GridBagConstraints.WEST, GridBagConstraints.NONE,
445 new Insets(0, 2, 4, 0), 5, 0));
446 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
447 , GridBagConstraints.WEST,
448 GridBagConstraints.NONE,
449 new Insets(0, 0, 4, 0), 11, 6));
450 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0
451 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
452 new Insets(16, 0, 0, 12), 359, -17));
453 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
454 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
455 new Insets(21, 0, 35, 12), 4, 6));
456 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
457 , GridBagConstraints.WEST, GridBagConstraints.NONE,
458 new Insets(16, 0, 0, 0), 5, 1));
459 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
460 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
461 new Insets(0, 2, 4, 2), 54, 1));
462 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
463 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
464 new Insets(0, 2, 4, 0), 263, 1));
465 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
466 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
467 new Insets(15, 0, 0, 15), 307, 1));
469 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
470 , GridBagConstraints.WEST,
471 GridBagConstraints.NONE,
472 new Insets(0, 2, 5, 185), 2,
474 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
475 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
476 gapSymbolCB.setRenderer(dlcr);
478 tabbedPane.add(visualTab, "Visual");
479 tabbedPane.add(connectTab, "Connections");
480 tabbedPane.add(exportTab, "Output");
481 jPanel11.add(jLabel1);
483 jPanel11.add(clustaljv);
484 jPanel11.add(fastajv);
486 jPanel11.add(pfamjv);
487 jPanel11.add(pileupjv);
489 exportTab.add(modellerOutput);
490 tabbedPane.add(calcTab, "Editing");
491 calcTab.add(autoCalculateConsCheck);
492 calcTab.add(padGaps);
493 tabbedPane.add(dasPanel, "DAS Settings");
495 exportTab.add(epsLabel);
496 exportTab.add(epsRendering);
497 exportTab.add(jPanel11);
503 * @param e DOCUMENT ME!
505 public void ok_actionPerformed(ActionEvent e)
512 * @param e DOCUMENT ME!
514 public void cancel_actionPerformed(ActionEvent e)
521 * @param e DOCUMENT ME!
523 public void annotations_actionPerformed(ActionEvent e)
530 public void startupFileTextfield_mouseClicked()
534 public void newLink_actionPerformed(ActionEvent e)
539 public void editLink_actionPerformed(ActionEvent e)
544 public void deleteLink_actionPerformed(ActionEvent e)
549 public void defaultBrowser_mouseClicked(MouseEvent e)
554 public void linkURLList_keyTyped(KeyEvent e)
559 public void useProxy_actionPerformed()
561 proxyServerTB.setEnabled(useProxy.isSelected());
562 proxyPortTB.setEnabled(useProxy.isSelected());