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 fullID = new JCheckBox();
\r
46 protected JCheckBox fullScreen = new JCheckBox();
\r
47 protected JCheckBox conservation = new JCheckBox();
\r
48 protected JCheckBox identity = new JCheckBox();
\r
49 protected JCheckBox annotations = new JCheckBox();
\r
50 JLabel gapLabel = new JLabel();
\r
51 protected JComboBox colour = new JComboBox();
\r
52 JLabel colourLabel = new JLabel();
\r
53 JLabel fontLabel = new JLabel();
\r
54 protected JComboBox fontSizeCB = new JComboBox();
\r
55 protected JComboBox fontStyleCB = new JComboBox();
\r
56 protected JComboBox fontNameCB = new JComboBox();
\r
57 protected JComboBox gapSymbolCB = new JComboBox();
\r
58 protected JCheckBox startupCheckbox = new JCheckBox();
\r
59 protected JTextField startupFileTextfield = new JTextField();
\r
60 JPanel connectTab = new JPanel();
\r
61 JLabel serverLabel = new JLabel();
\r
62 protected JList linkURLList = new JList();
\r
63 protected JTextField proxyServerTB = new JTextField();
\r
64 protected JTextField proxyPortTB = new JTextField();
\r
65 JLabel portLabel = new JLabel();
\r
66 JLabel browserLabel = new JLabel();
\r
67 protected JTextField defaultBrowser = new JTextField();
\r
68 JButton newLink = new JButton();
\r
69 JButton editLink = new JButton();
\r
70 JButton deleteLink = new JButton();
\r
71 JScrollPane linkScrollPane = new JScrollPane();
\r
72 JPanel linkPanel = new JPanel();
\r
73 BorderLayout borderLayout2 = new BorderLayout();
\r
74 JPanel editLinkButtons = new JPanel();
\r
75 GridLayout gridLayout1 = new GridLayout();
\r
76 protected JList linkNameList = new JList();
\r
77 JPanel linkPanel2 = new JPanel();
\r
78 BorderLayout borderLayout3 = new BorderLayout();
\r
79 protected JCheckBox useProxy = new JCheckBox();
\r
80 JPanel jPanel1 = new JPanel();
\r
81 TitledBorder titledBorder1 = new TitledBorder("Proxy Server");
\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
88 * Creates a new GPreferences object.
\r
90 public GPreferences()
\r
96 catch (Exception ex)
\r
98 ex.printStackTrace();
\r
105 * @throws Exception DOCUMENT ME!
\r
107 private void jbInit() throws Exception
\r
109 this.setLayout(borderLayout1);
\r
111 ok.addActionListener(new ActionListener()
\r
113 public void actionPerformed(ActionEvent e)
\r
115 ok_actionPerformed(e);
\r
118 cancel.setText("Cancel");
\r
119 cancel.addActionListener(new ActionListener()
\r
121 public void actionPerformed(ActionEvent e)
\r
123 cancel_actionPerformed(e);
\r
126 quality.setEnabled(false);
\r
127 quality.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
128 quality.setHorizontalAlignment(SwingConstants.RIGHT);
\r
129 quality.setHorizontalTextPosition(SwingConstants.LEFT);
\r
130 quality.setSelected(true);
\r
131 quality.setText("Quality");
\r
132 quality.setBounds(new Rectangle(248, 53, 81, 23));
\r
133 visualTab.setBorder(new TitledBorder("Open new alignment"));
\r
134 visualTab.setBounds(new Rectangle(9, 20, 442, 241));
\r
135 visualTab.setLayout(null);
\r
136 fullID.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
137 fullID.setHorizontalAlignment(SwingConstants.RIGHT);
\r
138 fullID.setHorizontalTextPosition(SwingConstants.LEFT);
\r
139 fullID.setText("Full Sequence ID");
\r
140 fullID.setBounds(new Rectangle(9, 78, 129, 23));
\r
141 fullScreen.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
142 fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);
\r
143 fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);
\r
144 fullScreen.setText("Maximise Window");
\r
145 fullScreen.setBounds(new Rectangle(5, 29, 132, 23));
\r
146 conservation.setEnabled(false);
\r
147 conservation.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
148 conservation.setHorizontalAlignment(SwingConstants.RIGHT);
\r
149 conservation.setHorizontalTextPosition(SwingConstants.LEFT);
\r
150 conservation.setSelected(true);
\r
151 conservation.setText("Conservation");
\r
152 conservation.setBounds(new Rectangle(137, 53, 113, 23));
\r
153 identity.setEnabled(false);
\r
154 identity.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
155 identity.setHorizontalAlignment(SwingConstants.RIGHT);
\r
156 identity.setHorizontalTextPosition(SwingConstants.LEFT);
\r
157 identity.setSelected(true);
\r
158 identity.setText("Consensus");
\r
159 identity.setBounds(new Rectangle(326, 53, 99, 23));
\r
160 annotations.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
161 annotations.setHorizontalAlignment(SwingConstants.RIGHT);
\r
162 annotations.setHorizontalTextPosition(SwingConstants.LEFT);
\r
163 annotations.setSelected(true);
\r
164 annotations.setText("Show Annotations");
\r
165 annotations.setBounds(new Rectangle(10, 53, 128, 23));
\r
166 annotations.addActionListener(new ActionListener()
\r
168 public void actionPerformed(ActionEvent e)
\r
170 annotations_actionPerformed(e);
\r
173 gapLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
174 gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
175 gapLabel.setText("Gap Symbol");
\r
176 gapLabel.setBounds(new Rectangle(41, 142, 76, 15));
\r
177 colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
178 colour.setBounds(new Rectangle(121, 168, 154, 21));
\r
179 colourLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
180 colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
181 colourLabel.setText("Colour");
\r
182 colourLabel.setBounds(new Rectangle(60, 172, 58, 15));
\r
183 fontLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
184 fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
185 fontLabel.setText("Font");
\r
186 fontLabel.setBounds(new Rectangle(83, 114, 34, 15));
\r
187 fontSizeCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
188 fontSizeCB.setBounds(new Rectangle(304, 109, 49, 21));
\r
189 fontStyleCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
190 fontStyleCB.setBounds(new Rectangle(353, 109, 80, 21));
\r
191 fontNameCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
192 fontNameCB.setBounds(new Rectangle(121, 109, 183, 21));
\r
193 gapSymbolCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
194 gapSymbolCB.setBounds(new Rectangle(121, 140, 67, 21));
\r
195 startupCheckbox.setText("Open file");
\r
196 startupCheckbox.setBounds(new Rectangle(4, 200, 115, 23));
\r
197 startupCheckbox.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
198 startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);
\r
199 startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
\r
200 startupCheckbox.setSelected(true);
\r
201 startupFileTextfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
202 startupFileTextfield.setBounds(new Rectangle(121, 200, 309, 20));
\r
203 startupFileTextfield.addMouseListener(new MouseAdapter()
\r
205 public void mouseClicked(MouseEvent e)
\r
207 if (e.getClickCount() > 1)
\r
209 startupFileTextfield_mouseClicked();
\r
214 connectTab.setLayout(gridBagLayout3);
\r
215 serverLabel.setText("Address");
\r
216 serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
217 serverLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
218 proxyServerTB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
219 proxyPortTB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
220 portLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
221 portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
222 portLabel.setText("Port");
\r
223 browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
\r
224 browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
\r
225 browserLabel.setText("Default Browser (Unix)");
\r
226 defaultBrowser.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
227 defaultBrowser.setText("");
\r
228 newLink.setText("New");
\r
229 newLink.addActionListener(new java.awt.event.ActionListener() {
\r
230 public void actionPerformed(ActionEvent e) {
\r
231 newLink_actionPerformed(e);
\r
234 editLink.setText("Edit");
\r
235 editLink.addActionListener(new java.awt.event.ActionListener() {
\r
236 public void actionPerformed(ActionEvent e) {
\r
237 editLink_actionPerformed(e);
\r
240 deleteLink.setText("Delete");
\r
241 deleteLink.addActionListener(new java.awt.event.ActionListener() {
\r
242 public void actionPerformed(ActionEvent e) {
\r
243 deleteLink_actionPerformed(e);
\r
247 linkURLList.addListSelectionListener(new ListSelectionListener()
\r
249 public void valueChanged(ListSelectionEvent e)
\r
251 int index = linkURLList.getSelectedIndex();
\r
252 linkNameList.setSelectedIndex(index);
\r
256 linkNameList.addListSelectionListener(new ListSelectionListener()
\r
258 public void valueChanged(ListSelectionEvent e)
\r
260 int index = linkNameList.getSelectedIndex();
\r
261 linkURLList.setSelectedIndex(index);
\r
265 linkScrollPane.setBorder(null);
\r
266 linkPanel.setBorder(new TitledBorder("URL link from Sequence ID"));
\r
267 linkPanel.setLayout(borderLayout2);
\r
268 editLinkButtons.setLayout(gridLayout1);
\r
269 gridLayout1.setRows(3);
\r
270 linkNameList.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
\r
271 linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
\r
272 linkPanel2.setLayout(borderLayout3);
\r
273 linkURLList.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
274 linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
\r
276 defaultBrowser.addMouseListener(new MouseAdapter()
\r
278 public void mouseClicked(MouseEvent e)
\r
280 if (e.getClickCount() > 1)
\r
282 defaultBrowser_mouseClicked(e);
\r
286 useProxy.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
287 useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
\r
288 useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
\r
289 useProxy.setText("Use a proxy server");
\r
290 useProxy.addActionListener(new ActionListener()
\r
292 public void actionPerformed(ActionEvent e)
\r
294 useProxy_actionPerformed();
\r
297 jPanel1.setBorder(titledBorder1);
\r
298 jPanel1.setLayout(gridBagLayout1);
\r
299 sortby.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
300 sortby.setBounds(new Rectangle(122, 232, 308, 21));
\r
301 sortLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
302 sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
\r
303 sortLabel.setText("Sort by");
\r
304 sortLabel.setBounds(new Rectangle(53, 235, 64, 15));
\r
305 visualTab.add(annotations);
\r
306 visualTab.add(conservation);
\r
307 visualTab.add(quality);
\r
308 visualTab.add(fullID);
\r
309 visualTab.add(gapSymbolCB);
\r
310 visualTab.add(fontLabel);
\r
311 visualTab.add(fontNameCB);
\r
312 visualTab.add(colourLabel);
\r
313 visualTab.add(gapLabel);
\r
314 visualTab.add(colour);
\r
315 visualTab.add(fontSizeCB);
\r
316 visualTab.add(fontStyleCB);
\r
317 visualTab.add(identity);
\r
318 visualTab.add(fullScreen);
\r
319 visualTab.add(startupCheckbox);
\r
320 visualTab.add(startupFileTextfield);
\r
321 visualTab.add(sortby);
\r
322 visualTab.add(sortLabel);
\r
324 tabbedPane.add(visualTab, "Visual");
\r
325 tabbedPane.add(connectTab, "Connections");
\r
327 linkPanel.add(editLinkButtons, BorderLayout.EAST);
\r
328 editLinkButtons.add(newLink, null);
\r
329 editLinkButtons.add(editLink, null);
\r
330 editLinkButtons.add(deleteLink, null);
\r
331 linkPanel.add(linkScrollPane, BorderLayout.CENTER);
\r
332 linkScrollPane.getViewport().add(linkPanel2, null);
\r
333 linkPanel2.add(linkURLList, BorderLayout.CENTER);
\r
334 linkPanel2.add(linkNameList, BorderLayout.WEST);
\r
335 okCancelPanel.add(ok);
\r
336 okCancelPanel.add(cancel);
\r
337 this.add(tabbedPane, java.awt.BorderLayout.CENTER);
\r
339 this.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
\r
340 jPanel1.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
\r
341 , GridBagConstraints.WEST, GridBagConstraints.NONE,
\r
342 new Insets(0, 2, 4, 0), 5, 0));
\r
343 jPanel1.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
\r
344 , GridBagConstraints.WEST,
\r
345 GridBagConstraints.NONE,
\r
346 new Insets(0, 0, 4, 0), 11, 6));
\r
347 connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0
\r
348 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
\r
349 new Insets(16, 0, 0, 12), 359, -17));
\r
350 connectTab.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
\r
351 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
\r
352 new Insets(21, 0, 35, 12), 4, 6));
\r
353 connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
\r
354 , GridBagConstraints.WEST, GridBagConstraints.NONE,
\r
355 new Insets(16, 0, 0, 0), 5, 1));
\r
356 jPanel1.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
\r
357 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
\r
358 new Insets(0, 2, 4, 2), 54, 1));
\r
359 jPanel1.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
\r
360 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
\r
361 new Insets(0, 2, 4, 0), 263, 1));
\r
362 connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
\r
363 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
\r
364 new Insets(15, 0, 0, 15), 307, 1));
\r
365 jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
\r
366 , GridBagConstraints.WEST,
\r
367 GridBagConstraints.NONE,
\r
368 new Insets(0, 2, 5, 185), 2,
\r
370 DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
\r
371 dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
\r
372 gapSymbolCB.setRenderer(dlcr);
\r
378 * @param e DOCUMENT ME!
\r
380 public void ok_actionPerformed(ActionEvent e)
\r
387 * @param e DOCUMENT ME!
\r
389 public void cancel_actionPerformed(ActionEvent e)
\r
396 * @param e DOCUMENT ME!
\r
398 public void annotations_actionPerformed(ActionEvent e)
\r
406 public void startupFileTextfield_mouseClicked()
\r
411 public void newLink_actionPerformed(ActionEvent e) {
\r
415 public void editLink_actionPerformed(ActionEvent e) {
\r
419 public void deleteLink_actionPerformed(ActionEvent e) {
\r
423 public void defaultBrowser_mouseClicked(MouseEvent e)
\r
428 public void linkURLList_keyTyped(KeyEvent e)
\r
433 public void useProxy_actionPerformed()
\r
435 proxyServerTB.setEnabled(useProxy.isSelected());
\r
436 proxyPortTB.setEnabled(useProxy.isSelected());
\r