2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2007 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
22 import java.awt.event.*;
\r
23 import javax.swing.*;
\r
29 * @version $Revision$
\r
31 public class GUserDefinedColours
\r
34 protected JColorChooser colorChooser = new JColorChooser();
\r
35 protected JPanel buttonPanel = new JPanel();
\r
36 protected GridLayout gridLayout = new GridLayout();
\r
37 JPanel lowerPanel = new JPanel();
\r
38 protected JButton okButton = new JButton();
\r
39 protected JButton applyButton = new JButton();
\r
40 protected JButton loadbutton = new JButton();
\r
41 protected JButton savebutton = new JButton();
\r
42 protected JButton cancelButton = new JButton();
\r
43 JPanel namePanel = new JPanel();
\r
44 JLabel jLabel1 = new JLabel();
\r
45 protected JTextField schemeName = new JTextField();
\r
46 BorderLayout borderLayout1 = new BorderLayout();
\r
47 JPanel panel1 = new JPanel();
\r
48 JPanel okCancelPanel = new JPanel();
\r
49 JPanel saveLoadPanel = new JPanel();
\r
50 BorderLayout borderLayout3 = new BorderLayout();
\r
51 GridBagLayout gridBagLayout1 = new GridBagLayout();
\r
52 BorderLayout borderLayout2 = new BorderLayout();
\r
53 FlowLayout flowLayout1 = new FlowLayout();
\r
54 BorderLayout borderLayout4 = new BorderLayout();
\r
55 JPanel jPanel4 = new JPanel();
\r
56 BorderLayout borderLayout5 = new BorderLayout();
\r
57 JLabel label = new JLabel();
\r
58 protected JPanel casePanel = new JPanel();
\r
59 protected JCheckBox caseSensitive = new JCheckBox();
\r
60 protected JButton lcaseColour = new JButton();
\r
62 * Creates a new GUserDefinedColours object.
\r
64 public GUserDefinedColours()
\r
72 e.printStackTrace();
\r
80 * @throws Exception DOCUMENT ME!
\r
82 private void jbInit()
\r
85 this.setLayout(borderLayout4);
\r
86 buttonPanel.setLayout(gridLayout);
\r
87 gridLayout.setColumns(4);
\r
88 gridLayout.setRows(5);
\r
89 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
\r
90 okButton.setText("OK");
\r
91 okButton.addActionListener(new java.awt.event.ActionListener()
\r
93 public void actionPerformed(ActionEvent e)
\r
95 okButton_actionPerformed(e);
\r
98 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
\r
99 applyButton.setText("Apply");
\r
100 applyButton.addActionListener(new java.awt.event.ActionListener()
\r
102 public void actionPerformed(ActionEvent e)
\r
104 applyButton_actionPerformed(e);
\r
107 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
\r
108 loadbutton.setText("Load scheme");
\r
109 loadbutton.addActionListener(new java.awt.event.ActionListener()
\r
111 public void actionPerformed(ActionEvent e)
\r
113 loadbutton_actionPerformed(e);
\r
116 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
\r
117 savebutton.setText("Save scheme");
\r
118 savebutton.addActionListener(new java.awt.event.ActionListener()
\r
120 public void actionPerformed(ActionEvent e)
\r
122 savebutton_actionPerformed(e);
\r
125 cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));
\r
126 cancelButton.setText("Cancel");
\r
127 cancelButton.addActionListener(new java.awt.event.ActionListener()
\r
129 public void actionPerformed(ActionEvent e)
\r
131 cancelButton_actionPerformed(e);
\r
134 this.setBackground(new Color(212, 208, 223));
\r
135 lowerPanel.setOpaque(false);
\r
136 lowerPanel.setLayout(borderLayout3);
\r
137 colorChooser.setOpaque(false);
\r
138 jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
139 jLabel1.setText("Name");
\r
140 namePanel.setMinimumSize(new Dimension(300, 31));
\r
141 namePanel.setOpaque(false);
\r
142 namePanel.setPreferredSize(new Dimension(240, 25));
\r
143 namePanel.setLayout(borderLayout1);
\r
144 schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
145 schemeName.setPreferredSize(new Dimension(105, 21));
\r
146 schemeName.setText("");
\r
147 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
\r
148 panel1.setLayout(flowLayout1);
\r
149 panel1.setOpaque(false);
\r
150 okCancelPanel.setOpaque(false);
\r
151 saveLoadPanel.setOpaque(false);
\r
152 jPanel4.setLayout(borderLayout5);
\r
153 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
\r
154 label.setOpaque(false);
\r
155 label.setPreferredSize(new Dimension(260, 34));
\r
157 "<html>Save your colour scheme with a unique name and it will be added " +
\r
158 "to the Colour menu.</html>");
\r
159 caseSensitive.setText("Case Sensitive");
\r
160 caseSensitive.addActionListener(new ActionListener()
\r
162 public void actionPerformed(ActionEvent e)
\r
164 caseSensitive_actionPerformed(e);
\r
167 lcaseColour.setText("Lower Case Colour");
\r
168 lcaseColour.addActionListener(new ActionListener()
\r
170 public void actionPerformed(ActionEvent e)
\r
172 lcaseColour_actionPerformed(e);
\r
176 saveLoadPanel.add(savebutton);
\r
177 saveLoadPanel.add(loadbutton);
\r
178 okCancelPanel.add(applyButton);
\r
179 okCancelPanel.add(okButton);
\r
180 okCancelPanel.add(cancelButton);
\r
181 lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
\r
182 lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
\r
184 namePanel.add(schemeName, java.awt.BorderLayout.CENTER);
\r
185 namePanel.add(jLabel1, java.awt.BorderLayout.WEST);
\r
186 panel1.add(namePanel, null);
\r
187 panel1.add(buttonPanel, null);
\r
188 panel1.add(casePanel);
\r
189 casePanel.add(caseSensitive);
\r
190 casePanel.add(lcaseColour);
\r
191 panel1.add(lowerPanel, null);
\r
194 jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
\r
195 this.add(jPanel4, java.awt.BorderLayout.CENTER);
\r
196 this.add(colorChooser, java.awt.BorderLayout.EAST);
\r
202 * @param e DOCUMENT ME!
\r
204 protected void okButton_actionPerformed(ActionEvent e)
\r
211 * @param e DOCUMENT ME!
\r
213 protected void applyButton_actionPerformed(ActionEvent e)
\r
220 * @param e DOCUMENT ME!
\r
222 protected void loadbutton_actionPerformed(ActionEvent e)
\r
229 * @param e DOCUMENT ME!
\r
231 protected void savebutton_actionPerformed(ActionEvent e)
\r
238 * @param e DOCUMENT ME!
\r
240 protected void cancelButton_actionPerformed(ActionEvent e)
\r
244 public void caseSensitive_actionPerformed(ActionEvent e)
\r
249 public void lcaseColour_actionPerformed(ActionEvent e)
\r