2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 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.*;
31 public class GUserDefinedColours extends JPanel
33 protected JColorChooser colorChooser = new JColorChooser();
35 protected JPanel buttonPanel = new JPanel();
37 protected GridLayout gridLayout = new GridLayout();
39 JPanel lowerPanel = new JPanel();
41 protected JButton okButton = new JButton();
43 protected JButton applyButton = new JButton();
45 protected JButton loadbutton = new JButton();
47 protected JButton savebutton = new JButton();
49 protected JButton cancelButton = new JButton();
51 JPanel namePanel = new JPanel();
53 JLabel jLabel1 = new JLabel();
55 protected JTextField schemeName = new JTextField();
57 BorderLayout borderLayout1 = new BorderLayout();
59 JPanel panel1 = new JPanel();
61 JPanel okCancelPanel = new JPanel();
63 JPanel saveLoadPanel = new JPanel();
65 BorderLayout borderLayout3 = new BorderLayout();
67 GridBagLayout gridBagLayout1 = new GridBagLayout();
69 BorderLayout borderLayout2 = new BorderLayout();
71 FlowLayout flowLayout1 = new FlowLayout();
73 BorderLayout borderLayout4 = new BorderLayout();
75 JPanel jPanel4 = new JPanel();
77 BorderLayout borderLayout5 = new BorderLayout();
79 JLabel label = new JLabel();
81 protected JPanel casePanel = new JPanel();
83 protected JCheckBox caseSensitive = new JCheckBox();
85 protected JButton lcaseColour = new JButton();
88 * Creates a new GUserDefinedColours object.
90 public GUserDefinedColours()
108 private void jbInit() throws Exception
110 this.setLayout(borderLayout4);
111 buttonPanel.setLayout(gridLayout);
112 gridLayout.setColumns(4);
113 gridLayout.setRows(5);
114 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
115 okButton.setText("OK");
116 okButton.addActionListener(new java.awt.event.ActionListener()
118 public void actionPerformed(ActionEvent e)
120 okButton_actionPerformed(e);
123 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
124 applyButton.setText("Apply");
125 applyButton.addActionListener(new java.awt.event.ActionListener()
127 public void actionPerformed(ActionEvent e)
129 applyButton_actionPerformed(e);
132 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
133 loadbutton.setText("Load scheme");
134 loadbutton.addActionListener(new java.awt.event.ActionListener()
136 public void actionPerformed(ActionEvent e)
138 loadbutton_actionPerformed(e);
141 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
142 savebutton.setText("Save scheme");
143 savebutton.addActionListener(new java.awt.event.ActionListener()
145 public void actionPerformed(ActionEvent e)
147 savebutton_actionPerformed(e);
150 cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));
151 cancelButton.setText("Cancel");
152 cancelButton.addActionListener(new java.awt.event.ActionListener()
154 public void actionPerformed(ActionEvent e)
156 cancelButton_actionPerformed(e);
159 this.setBackground(new Color(212, 208, 223));
160 lowerPanel.setOpaque(false);
161 lowerPanel.setLayout(borderLayout3);
162 colorChooser.setOpaque(false);
163 jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
164 jLabel1.setText("Name");
165 namePanel.setMinimumSize(new Dimension(300, 31));
166 namePanel.setOpaque(false);
167 namePanel.setPreferredSize(new Dimension(240, 25));
168 namePanel.setLayout(borderLayout1);
169 schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
170 schemeName.setPreferredSize(new Dimension(105, 21));
171 schemeName.setText("");
172 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
173 panel1.setLayout(flowLayout1);
174 panel1.setOpaque(false);
175 okCancelPanel.setOpaque(false);
176 saveLoadPanel.setOpaque(false);
177 jPanel4.setLayout(borderLayout5);
178 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
179 label.setOpaque(false);
180 label.setPreferredSize(new Dimension(260, 34));
182 .setText("<html>Save your colour scheme with a unique name and it will be added "
183 + "to the Colour menu.</html>");
184 caseSensitive.setText("Case Sensitive");
185 caseSensitive.addActionListener(new ActionListener()
187 public void actionPerformed(ActionEvent e)
189 caseSensitive_actionPerformed(e);
192 lcaseColour.setText("Lower Case Colour");
193 lcaseColour.addActionListener(new ActionListener()
195 public void actionPerformed(ActionEvent e)
197 lcaseColour_actionPerformed(e);
201 saveLoadPanel.add(savebutton);
202 saveLoadPanel.add(loadbutton);
203 okCancelPanel.add(applyButton);
204 okCancelPanel.add(okButton);
205 okCancelPanel.add(cancelButton);
206 lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
207 lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
209 namePanel.add(schemeName, java.awt.BorderLayout.CENTER);
210 namePanel.add(jLabel1, java.awt.BorderLayout.WEST);
211 panel1.add(namePanel, null);
212 panel1.add(buttonPanel, null);
213 panel1.add(casePanel);
214 casePanel.add(caseSensitive);
215 casePanel.add(lcaseColour);
216 panel1.add(lowerPanel, null);
219 jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
220 this.add(jPanel4, java.awt.BorderLayout.CENTER);
221 this.add(colorChooser, java.awt.BorderLayout.EAST);
230 protected void okButton_actionPerformed(ActionEvent e)
240 protected void applyButton_actionPerformed(ActionEvent e)
250 protected void loadbutton_actionPerformed(ActionEvent e)
260 protected void savebutton_actionPerformed(ActionEvent e)
270 protected void cancelButton_actionPerformed(ActionEvent e)
274 public void caseSensitive_actionPerformed(ActionEvent e)
279 public void lcaseColour_actionPerformed(ActionEvent e)