2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.jbgui;
20 import jalview.gui.JvSwingUtils;
23 import java.awt.event.*;
32 public class GUserDefinedColours extends JPanel
34 protected JColorChooser colorChooser = new JColorChooser();
36 protected JPanel buttonPanel = new JPanel();
38 protected GridLayout gridLayout = new GridLayout();
40 JPanel lowerPanel = new JPanel();
42 protected JButton okButton = new JButton();
44 protected JButton applyButton = new JButton();
46 protected JButton loadbutton = new JButton();
48 protected JButton savebutton = new JButton();
50 protected JButton cancelButton = new JButton();
52 JPanel namePanel = new JPanel();
54 JLabel jLabel1 = new JLabel();
56 protected JTextField schemeName = new JTextField();
58 BorderLayout borderLayout1 = new BorderLayout();
60 JPanel panel1 = new JPanel();
62 JPanel okCancelPanel = new JPanel();
64 JPanel saveLoadPanel = new JPanel();
66 BorderLayout borderLayout3 = new BorderLayout();
68 GridBagLayout gridBagLayout1 = new GridBagLayout();
70 BorderLayout borderLayout2 = new BorderLayout();
72 FlowLayout flowLayout1 = new FlowLayout();
74 BorderLayout borderLayout4 = new BorderLayout();
76 JPanel jPanel4 = new JPanel();
78 BorderLayout borderLayout5 = new BorderLayout();
80 JLabel label = new JLabel();
82 protected JPanel casePanel = new JPanel();
84 protected JCheckBox caseSensitive = new JCheckBox();
86 protected JButton lcaseColour = new JButton();
89 * Creates a new GUserDefinedColours object.
91 public GUserDefinedColours()
109 private void jbInit() throws Exception
111 this.setLayout(borderLayout4);
112 buttonPanel.setLayout(gridLayout);
113 gridLayout.setColumns(4);
114 gridLayout.setRows(5);
115 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
116 okButton.setText("OK");
117 okButton.addActionListener(new java.awt.event.ActionListener()
119 public void actionPerformed(ActionEvent e)
121 okButton_actionPerformed(e);
124 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
125 applyButton.setText("Apply");
126 applyButton.addActionListener(new java.awt.event.ActionListener()
128 public void actionPerformed(ActionEvent e)
130 applyButton_actionPerformed(e);
133 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
134 loadbutton.setText("Load scheme");
135 loadbutton.addActionListener(new java.awt.event.ActionListener()
137 public void actionPerformed(ActionEvent e)
139 loadbutton_actionPerformed(e);
142 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
143 savebutton.setText("Save scheme");
144 savebutton.addActionListener(new java.awt.event.ActionListener()
146 public void actionPerformed(ActionEvent e)
148 savebutton_actionPerformed(e);
151 cancelButton.setFont(JvSwingUtils.getLabelFont());
152 cancelButton.setText("Cancel");
153 cancelButton.addActionListener(new java.awt.event.ActionListener()
155 public void actionPerformed(ActionEvent e)
157 cancelButton_actionPerformed(e);
160 this.setBackground(new Color(212, 208, 223));
161 lowerPanel.setOpaque(false);
162 lowerPanel.setLayout(borderLayout3);
163 colorChooser.setOpaque(false);
164 jLabel1.setFont(JvSwingUtils.getLabelFont());
165 jLabel1.setText("Name");
166 namePanel.setMinimumSize(new Dimension(300, 31));
167 namePanel.setOpaque(false);
168 namePanel.setPreferredSize(new Dimension(240, 25));
169 namePanel.setLayout(borderLayout1);
170 schemeName.setFont(JvSwingUtils.getLabelFont());
171 schemeName.setPreferredSize(new Dimension(105, 21));
172 schemeName.setText("");
173 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
174 panel1.setLayout(flowLayout1);
175 panel1.setOpaque(false);
176 okCancelPanel.setOpaque(false);
177 saveLoadPanel.setOpaque(false);
178 jPanel4.setLayout(borderLayout5);
179 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
180 label.setOpaque(false);
181 label.setPreferredSize(new Dimension(260, 34));
182 label.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)