2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.jbgui;
\r
23 import javax.swing.*;
\r
24 import javax.swing.border.TitledBorder;
\r
25 import java.awt.event.*;
\r
26 import javax.swing.event.*;
\r
33 * @version $Revision$
\r
35 public class GPreferences extends JPanel
\r
37 JTabbedPane tabbedPane = new JTabbedPane();
\r
39 JButton ok = new JButton();
\r
40 JButton cancel = new JButton();
\r
41 JPanel okCancelPanel = new JPanel();
\r
42 BorderLayout borderLayout1 = new BorderLayout();
\r
43 protected JCheckBox quality = new JCheckBox();
\r
44 JPanel visualTab = new JPanel();
\r
45 protected JCheckBox fullScreen = new JCheckBox();
\r
46 protected JCheckBox conservation = new JCheckBox();
\r
47 protected JCheckBox identity = new JCheckBox();
\r
48 protected JCheckBox annotations = new JCheckBox();
\r
49 JLabel gapLabel = new JLabel();
\r
50 protected JComboBox colour = new JComboBox();
\r
51 JLabel colourLabel = new JLabel();
\r
52 JLabel fontLabel = new JLabel();
\r
53 protected JComboBox fontSizeCB = new JComboBox();
\r
54 protected JComboBox fontStyleCB = new JComboBox();
\r
55 protected JComboBox fontNameCB = new JComboBox();
\r
56 protected JComboBox gapSymbolCB = new JComboBox();
\r
57 protected JCheckBox startupCheckbox = new JCheckBox();
\r
58 protected JTextField startupFileTextfield = new JTextField();
\r
59 JPanel connectTab = new JPanel();
\r
60 JLabel serverLabel = new JLabel();
\r
61 protected JList linkURLList = new JList();
\r
62 protected JTextField proxyServerTB = new JTextField();
\r
63 protected JTextField proxyPortTB = new JTextField();
\r
64 JLabel portLabel = new JLabel();
\r
65 JLabel browserLabel = new JLabel();
\r
66 protected JTextField defaultBrowser = new JTextField();
\r
67 JButton newLink = new JButton();
\r
68 JButton editLink = new JButton();
\r
69 JButton deleteLink = new JButton();
\r
70 JScrollPane linkScrollPane = new JScrollPane();
\r
71 JPanel linkPanel = new JPanel();
\r
72 BorderLayout borderLayout2 = new BorderLayout();
\r
73 JPanel editLinkButtons = new JPanel();
\r
74 GridLayout gridLayout1 = new GridLayout();
\r
75 protected JList linkNameList = new JList();
\r
76 JPanel linkPanel2 = new JPanel();
\r
77 BorderLayout borderLayout3 = new BorderLayout();
\r
78 protected JCheckBox useProxy = new JCheckBox();
\r
79 JPanel jPanel1 = new JPanel();
\r
80 TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
\r
81 TitledBorder titledBorder2 = new TitledBorder("File Output");
\r
82 GridBagLayout gridBagLayout2 = new GridBagLayout();
\r
83 GridBagLayout gridBagLayout1 = new GridBagLayout();
\r
84 GridBagLayout gridBagLayout3 = new GridBagLayout();
\r
85 protected JComboBox sortby = new JComboBox();
\r
86 JLabel sortLabel = new JLabel();
\r
87 JPanel jPanel2 = new JPanel();
\r
88 GridLayout gridLayout2 = new GridLayout();
\r
89 JPanel jPanel3 = new JPanel();
\r
90 JPanel exportTab = new JPanel();
\r
91 JLabel epsLabel = new JLabel();
\r
92 protected JComboBox epsRendering = new JComboBox();
\r
93 JLabel jLabel1 = new JLabel();
\r
94 protected JCheckBox blcjv = new JCheckBox();
\r
95 protected JCheckBox pileupjv = new JCheckBox();
\r
96 protected JCheckBox clustaljv = new JCheckBox();
\r
97 protected JCheckBox msfjv = new JCheckBox();
\r
98 protected JCheckBox fastajv = new JCheckBox();
\r
99 protected JCheckBox pfamjv = new JCheckBox();
\r
100 FlowLayout flowLayout1 = new FlowLayout();
\r
101 protected JCheckBox pirjv = new JCheckBox();
\r
102 JPanel jPanel11 = new JPanel();
\r
103 Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);
\r
104 protected JCheckBox seqLimit = new JCheckBox();
\r
105 GridLayout gridLayout3 = new GridLayout();
\r
106 protected JCheckBox smoothFont = new JCheckBox();
\r
107 JPanel calcTab = new JPanel();
\r
108 protected JCheckBox autoCalculateConsCheck = new JCheckBox();
\r
109 protected JCheckBox padGaps = new JCheckBox();
\r
110 protected JCheckBox modellerOutput = new JCheckBox();
\r
112 * Creates a new GPreferences object.
\r
114 public GPreferences()
\r
120 catch (Exception ex)
\r
122 ex.printStackTrace();
\r
129 * @throws Exception DOCUMENT ME!
\r
131 private void jbInit() throws Exception
\r
133 this.setLayout(borderLayout1);
\r
135 ok.addActionListener(new ActionListener()
\r
137 public void actionPerformed(ActionEvent e)
\r
139 ok_actionPerformed(e);
\r
142 cancel.setText("Cancel");
\r
143 cancel.addActionListener(new ActionListener()
\r
145 public void actionPerformed(ActionEvent e)
\r
147 cancel_actionPerformed(e);
\r
150 quality.setEnabled(false);
\r
151 quality.setFont(verdana11);
\r
152 quality.setHorizontalAlignment(SwingConstants.RIGHT);
\r
153 quality.setHorizontalTextPosition(SwingConstants.LEFT);
\r
154 quality.setSelected(true);
\r
155 quality.setText("Quality");
\r
156 visualTab.setBorder(new TitledBorder("Open new alignment"));
\r
157 visualTab.setLayout(null);
\r
158 fullScreen.setFont(verdana11);
\r
159 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
\r
160 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
\r
161 fullScreen.setMargin(new Insets(2, 2, 2, 0));
\r
162 fullScreen.setText("Maximise Window");
\r
163 conservation.setEnabled(false);
\r
164 conservation.setFont(verdana11);
\r
165 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
\r
166 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
\r
167 conservation.setSelected(true);
\r
168 conservation.setText("Conservation");
\r
169 identity.setEnabled(false);
\r
170 identity.setFont(verdana11);
\r
171 identity.setHorizontalAlignment(SwingConstants.RIGHT);
\r
172 identity.setHorizontalTextPosition(SwingConstants.LEFT);
\r
173 identity.setSelected(true);
\r
174 identity.setText("Consensus");
\r
175 annotations.setFont(verdana11);
\r
176 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
\r
177 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
\r
178 annotations.setMargin(new Insets(2, 4, 2, 0));
\r
179 annotations.setSelected(true);
\r
180 annotations.setText("Show Annotations");
\r
181 annotations.addActionListener(new ActionListener()
\r
183 public void actionPerformed(ActionEvent e)
\r
185 annotations_actionPerformed(e);
\r
188 gapLabel.setFont(verdana11);
\r
189 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
190 gapLabel.setText("Gap Symbol ");
\r
191 colour.setFont(verdana11);
\r
192 colour.setBounds(new Rectangle(171, 180, 155, 21));
\r
193 colourLabel.setFont(verdana11);
\r
194 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
195 colourLabel.setText("Colour ");
\r
196 fontLabel.setFont(verdana11);
\r
197 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
198 fontLabel.setText("Font ");
\r
199 fontSizeCB.setFont(verdana11);
\r
200 fontSizeCB.setBounds(new Rectangle(318, 100, 49, 21));
\r
201 fontStyleCB.setFont(verdana11);
\r
202 fontStyleCB.setBounds(new Rectangle(366, 100, 70, 21));
\r
203 fontNameCB.setFont(verdana11);
\r
204 fontNameCB.setBounds(new Rectangle(171, 100, 147, 21));
\r
205 gapSymbolCB.setFont(verdana11);
\r
206 gapSymbolCB.setBounds(new Rectangle(171, 153, 69, 21));
\r
207 startupCheckbox.setText("Open file");
\r
208 startupCheckbox.setFont(verdana11);
\r
209 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
\r
210 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
\r
211 startupCheckbox.setSelected(true);
\r
212 startupFileTextfield.setFont(verdana11);
\r
213 startupFileTextfield.setBounds(new Rectangle(171, 236, 270, 20));
\r
214 startupFileTextfield.addMouseListener(new MouseAdapter()
\r
216 public void mouseClicked(MouseEvent e)
\r
218 if (e.getClickCount() > 1)
\r
220 startupFileTextfield_mouseClicked();
\r
225 connectTab.setLayout(gridBagLayout3);
\r
226 serverLabel.setText("Address");
\r
227 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
228 serverLabel.setFont(verdana11);
\r
229 proxyServerTB.setFont(verdana11);
\r
230 proxyPortTB.setFont(verdana11);
\r
231 portLabel.setFont(verdana11);
\r
232 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
233 portLabel.setText("Port");
\r
234 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
\r
235 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
\r
236 browserLabel.setText("Default Browser (Unix)");
\r
237 defaultBrowser.setFont(verdana11);
\r
238 defaultBrowser.setText("");
\r
239 newLink.setText("New");
\r
240 newLink.addActionListener(new java.awt.event.ActionListener() {
\r
241 public void actionPerformed(ActionEvent e) {
\r
242 newLink_actionPerformed(e);
\r
245 editLink.setText("Edit");
\r
246 editLink.addActionListener(new java.awt.event.ActionListener() {
\r
247 public void actionPerformed(ActionEvent e) {
\r
248 editLink_actionPerformed(e);
\r
251 deleteLink.setText("Delete");
\r
252 deleteLink.addActionListener(new java.awt.event.ActionListener() {
\r
253 public void actionPerformed(ActionEvent e) {
\r
254 deleteLink_actionPerformed(e);
\r
258 linkURLList.addListSelectionListener(new ListSelectionListener()
\r
260 public void valueChanged(ListSelectionEvent e)
\r
262 int index = linkURLList.getSelectedIndex();
\r
263 linkNameList.setSelectedIndex(index);
\r
267 linkNameList.addListSelectionListener(new ListSelectionListener()
\r
269 public void valueChanged(ListSelectionEvent e)
\r
271 int index = linkNameList.getSelectedIndex();
\r
272 linkURLList.setSelectedIndex(index);
\r
276 linkScrollPane.setBorder(null);
\r
277 linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
\r
278 linkPanel.setLayout(borderLayout2);
\r
279 editLinkButtons.setLayout(gridLayout1);
\r
280 gridLayout1.setRows(3);
\r
281 linkNameList.setFont(verdana11);
\r
282 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
\r
283 linkPanel2.setLayout(borderLayout3);
\r
284 linkURLList.setFont(verdana11);
\r
285 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
\r
287 defaultBrowser.addMouseListener(new MouseAdapter()
\r
289 public void mouseClicked(MouseEvent e)
\r
291 if (e.getClickCount() > 1)
\r
293 defaultBrowser_mouseClicked(e);
\r
297 useProxy.setFont(verdana11);
\r
298 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
\r
299 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
\r
300 useProxy.setText("Use a proxy server");
\r
301 useProxy.addActionListener(new ActionListener()
\r
303 public void actionPerformed(ActionEvent e)
\r
305 useProxy_actionPerformed();
\r
308 jPanel1.setBorder(titledBorder1);
\r
309 jPanel1.setLayout(gridBagLayout1);
\r
310 sortby.setFont(verdana11);
\r
311 sortby.setBounds(new Rectangle(171, 208, 155, 21));
\r
312 sortLabel.setFont(verdana11);
\r
313 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
314 sortLabel.setText("Sort by ");
\r
315 jPanel2.setBounds(new Rectangle(7, 17, 158, 245));
\r
316 jPanel2.setLayout(gridLayout2);
\r
317 gridLayout2.setRows(9);
\r
318 jPanel3.setBounds(new Rectangle(167, 41, 274, 26));
\r
319 exportTab.setLayout(null);
\r
320 epsLabel.setFont(verdana11);
\r
321 epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
322 epsLabel.setText("EPS Rendering Style");
\r
323 epsLabel.setBounds(new Rectangle(9, 31, 140, 24));
\r
324 epsRendering.setFont(verdana11);
\r
325 epsRendering.setBounds(new Rectangle(154, 34, 187, 21));
\r
326 jLabel1.setFont(verdana11);
\r
327 jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
\r
328 jLabel1.setText("Append /start-end (/15-380)");
\r
329 jLabel1.setFont(verdana11);
\r
330 fastajv.setFont(verdana11);
\r
331 fastajv.setHorizontalAlignment(SwingConstants.LEFT);
\r
332 clustaljv.setText("Clustal ");
\r
333 blcjv.setText("BLC ");
\r
334 fastajv.setText("Fasta ");
\r
335 msfjv.setText("MSF ");
\r
336 pfamjv.setText("PFAM ");
\r
337 pileupjv.setText("Pileup ");
\r
338 msfjv.setFont(verdana11);
\r
339 msfjv.setHorizontalAlignment(SwingConstants.LEFT);
\r
340 pirjv.setText("PIR ");
\r
341 jPanel11.setFont(verdana11);
\r
342 jPanel11.setBorder(titledBorder2);
\r
343 jPanel11.setBounds(new Rectangle(30, 72, 196, 182));
\r
344 jPanel11.setLayout(gridLayout3);
\r
345 blcjv.setFont(verdana11);
\r
346 blcjv.setHorizontalAlignment(SwingConstants.LEFT);
\r
347 clustaljv.setFont(verdana11);
\r
348 clustaljv.setHorizontalAlignment(SwingConstants.LEFT);
\r
349 pfamjv.setFont(verdana11);
\r
350 pfamjv.setHorizontalAlignment(SwingConstants.LEFT);
\r
351 pileupjv.setFont(verdana11);
\r
352 pileupjv.setHorizontalAlignment(SwingConstants.LEFT);
\r
353 pirjv.setFont(verdana11);
\r
354 pirjv.setHorizontalAlignment(SwingConstants.LEFT);
\r
355 seqLimit.setFont(verdana11);
\r
356 seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);
\r
357 seqLimit.setHorizontalTextPosition(SwingConstants.LEFT);
\r
358 seqLimit.setText("Full Sequence Id");
\r
359 gridLayout3.setRows(8);
\r
360 smoothFont.setFont(verdana11);
\r
361 smoothFont.setHorizontalAlignment(SwingConstants.RIGHT);
\r
362 smoothFont.setHorizontalTextPosition(SwingConstants.LEADING);
\r
363 smoothFont.setText("Smooth Font");
\r
364 calcTab.setLayout(null);
\r
365 autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
366 autoCalculateConsCheck.setText("AutoCalculate Consensus");
\r
367 autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23));
\r
368 padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
369 padGaps.setText("Pad gaps when editing");
\r
370 padGaps.setBounds(new Rectangle(22, 94, 168, 23));
\r
371 modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
372 modellerOutput.setText("Use Modeller Output");
\r
373 modellerOutput.setBounds(new Rectangle(228, 226, 168, 23));
\r
374 jPanel2.add(fullScreen);
\r
376 jPanel2.add(annotations);
\r
377 jPanel2.add(seqLimit);
\r
378 jPanel2.add(fontLabel);
\r
379 jPanel2.add(smoothFont);
\r
380 jPanel2.add(gapLabel);
\r
381 jPanel2.add(colourLabel);
\r
382 jPanel2.add(sortLabel);
\r
383 jPanel2.add(startupCheckbox);
\r
384 visualTab.add(colour);
\r
385 visualTab.add(gapSymbolCB);
\r
386 visualTab.add(startupFileTextfield);
\r
387 visualTab.add(sortby);
\r
388 visualTab.add(fontNameCB);
\r
389 visualTab.add(fontSizeCB);
\r
390 visualTab.add(fontStyleCB);
\r
391 visualTab.add(jPanel3);
\r
392 jPanel3.add(conservation);
\r
393 jPanel3.add(identity);
\r
394 jPanel3.add(quality);
\r
395 visualTab.add(jPanel2);
\r
396 linkPanel.add(editLinkButtons, BorderLayout.EAST);
\r
397 editLinkButtons.add(newLink, null);
\r
398 editLinkButtons.add(editLink, null);
\r
399 editLinkButtons.add(deleteLink, null);
\r
400 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
\r
401 linkScrollPane.getViewport().add(linkPanel2, null);
\r
402 linkPanel2.add(linkURLList, BorderLayout.CENTER);
\r
403 linkPanel2.add(linkNameList, BorderLayout.WEST);
\r
404 okCancelPanel.add(ok);
\r
405 okCancelPanel.add(cancel);
\r
406 this.add(tabbedPane, java.awt.BorderLayout.CENTER);
\r
408 this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
\r
409 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
\r
410 , GridBagConstraints.WEST, GridBagConstraints.NONE,
\r
411 new Insets(0, 2, 4, 0), 5, 0));
\r
412 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
\r
413 , GridBagConstraints.WEST,
\r
414 GridBagConstraints.NONE,
\r
415 new Insets(0, 0, 4, 0), 11, 6));
\r
416 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0
\r
417 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
\r
418 new Insets(16, 0, 0, 12), 359, -17));
\r
419 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
\r
420 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
\r
421 new Insets(21, 0, 35, 12), 4, 6));
\r
422 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
\r
423 , GridBagConstraints.WEST, GridBagConstraints.NONE,
\r
424 new Insets(16, 0, 0, 0), 5, 1));
\r
425 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
\r
426 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
\r
427 new Insets(0, 2, 4, 2), 54, 1));
\r
428 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
\r
429 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
\r
430 new Insets(0, 2, 4, 0), 263, 1));
\r
431 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
\r
432 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
\r
433 new Insets(15, 0, 0, 15), 307, 1));
\r
436 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
\r
437 , GridBagConstraints.WEST,
\r
438 GridBagConstraints.NONE,
\r
439 new Insets(0, 2, 5, 185), 2,
\r
441 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
\r
442 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
\r
443 gapSymbolCB.setRenderer(dlcr);
\r
445 tabbedPane.add(visualTab, "Visual");
\r
446 tabbedPane.add(connectTab,"Connections");
\r
447 tabbedPane.add(exportTab, "Output");
\r
448 jPanel11.add(jLabel1);
\r
449 jPanel11.add(blcjv);
\r
450 jPanel11.add(clustaljv);
\r
451 jPanel11.add(fastajv);
\r
452 jPanel11.add(msfjv);
\r
453 jPanel11.add(pfamjv);
\r
454 jPanel11.add(pileupjv);
\r
455 jPanel11.add(pirjv);
\r
456 exportTab.add(modellerOutput);
\r
457 tabbedPane.add(calcTab, "Editing");
\r
458 calcTab.add(autoCalculateConsCheck);
\r
459 calcTab.add(padGaps);
\r
461 exportTab.add(epsLabel);
\r
462 exportTab.add(epsRendering);
\r
463 exportTab.add(jPanel11);
\r
469 * @param e DOCUMENT ME!
\r
471 public void ok_actionPerformed(ActionEvent e)
\r
478 * @param e DOCUMENT ME!
\r
480 public void cancel_actionPerformed(ActionEvent e)
\r
487 * @param e DOCUMENT ME!
\r
489 public void annotations_actionPerformed(ActionEvent e)
\r
497 public void startupFileTextfield_mouseClicked()
\r
502 public void newLink_actionPerformed(ActionEvent e) {
\r
506 public void editLink_actionPerformed(ActionEvent e) {
\r
510 public void deleteLink_actionPerformed(ActionEvent e) {
\r
514 public void defaultBrowser_mouseClicked(MouseEvent e)
\r
519 public void linkURLList_keyTyped(KeyEvent e)
\r
524 public void useProxy_actionPerformed()
\r
526 proxyServerTB.setEnabled(useProxy.isSelected());
\r
527 proxyPortTB.setEnabled(useProxy.isSelected());
\r