2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.gui.JvSwingUtils;
24 import jalview.util.MessageManager;
27 import java.awt.event.*;
36 public class GUserDefinedColours extends JPanel
38 protected JColorChooser colorChooser = new JColorChooser();
40 protected JPanel buttonPanel = new JPanel();
42 protected GridLayout gridLayout = new GridLayout();
44 JPanel lowerPanel = new JPanel();
46 protected JButton okButton = new JButton();
48 protected JButton applyButton = new JButton();
50 protected JButton loadbutton = new JButton();
52 protected JButton savebutton = new JButton();
54 protected JButton cancelButton = new JButton();
56 JPanel namePanel = new JPanel();
58 JLabel jLabel1 = new JLabel();
60 protected JTextField schemeName = new JTextField();
62 BorderLayout borderLayout1 = new BorderLayout();
64 JPanel panel1 = new JPanel();
66 JPanel okCancelPanel = new JPanel();
68 JPanel saveLoadPanel = new JPanel();
70 BorderLayout borderLayout3 = new BorderLayout();
72 GridBagLayout gridBagLayout1 = new GridBagLayout();
74 BorderLayout borderLayout2 = new BorderLayout();
76 FlowLayout flowLayout1 = new FlowLayout();
78 BorderLayout borderLayout4 = new BorderLayout();
80 JPanel jPanel4 = new JPanel();
82 BorderLayout borderLayout5 = new BorderLayout();
84 JLabel label = new JLabel();
86 protected JPanel casePanel = new JPanel();
88 protected JCheckBox caseSensitive = new JCheckBox();
90 protected JButton lcaseColour = new JButton();
93 * Creates a new GUserDefinedColours object.
95 public GUserDefinedColours()
100 } catch (Exception e)
113 private void jbInit() throws Exception
115 this.setLayout(borderLayout4);
116 buttonPanel.setLayout(gridLayout);
117 gridLayout.setColumns(4);
118 gridLayout.setRows(5);
119 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
120 okButton.setText(MessageManager.getString("action.ok"));
121 okButton.addActionListener(new java.awt.event.ActionListener()
123 public void actionPerformed(ActionEvent e)
125 okButton_actionPerformed(e);
128 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
129 applyButton.setText(MessageManager.getString("action.apply"));
130 applyButton.addActionListener(new java.awt.event.ActionListener()
132 public void actionPerformed(ActionEvent e)
134 applyButton_actionPerformed(e);
137 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
138 loadbutton.setText(MessageManager.getString("action.load_scheme"));
139 loadbutton.addActionListener(new java.awt.event.ActionListener()
141 public void actionPerformed(ActionEvent e)
143 loadbutton_actionPerformed(e);
146 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
147 savebutton.setText(MessageManager.getString("action.save_scheme"));
148 savebutton.addActionListener(new java.awt.event.ActionListener()
150 public void actionPerformed(ActionEvent e)
152 savebutton_actionPerformed(e);
155 cancelButton.setFont(JvSwingUtils.getLabelFont());
156 cancelButton.setText(MessageManager.getString("action.cancel"));
157 cancelButton.addActionListener(new java.awt.event.ActionListener()
159 public void actionPerformed(ActionEvent e)
161 cancelButton_actionPerformed(e);
164 this.setBackground(new Color(212, 208, 223));
165 lowerPanel.setOpaque(false);
166 lowerPanel.setLayout(borderLayout3);
167 colorChooser.setOpaque(false);
168 jLabel1.setFont(JvSwingUtils.getLabelFont());
169 jLabel1.setText(MessageManager.getString("label.name"));
170 namePanel.setMinimumSize(new Dimension(300, 31));
171 namePanel.setOpaque(false);
172 namePanel.setPreferredSize(new Dimension(240, 25));
173 namePanel.setLayout(borderLayout1);
174 schemeName.setFont(JvSwingUtils.getLabelFont());
175 schemeName.setPreferredSize(new Dimension(105, 21));
176 schemeName.setText("");
177 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
178 panel1.setLayout(flowLayout1);
179 panel1.setOpaque(false);
180 okCancelPanel.setOpaque(false);
181 saveLoadPanel.setOpaque(false);
182 jPanel4.setLayout(borderLayout5);
183 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
184 label.setOpaque(false);
185 label.setPreferredSize(new Dimension(260, 34));
186 label.setText(MessageManager.formatMessage(
187 "label.html_content",
190 .getString("label.save_colour_scheme_with_unique_name_added_to_colour_menu") }));
191 caseSensitive.setText(MessageManager.getString("label.case_sensitive"));
192 caseSensitive.addActionListener(new ActionListener()
194 public void actionPerformed(ActionEvent e)
196 caseSensitive_actionPerformed(e);
200 .setText(MessageManager.getString("label.lower_case_colour"));
201 lcaseColour.addActionListener(new ActionListener()
203 public void actionPerformed(ActionEvent e)
205 lcaseColour_actionPerformed(e);
209 saveLoadPanel.add(savebutton);
210 saveLoadPanel.add(loadbutton);
211 okCancelPanel.add(applyButton);
212 okCancelPanel.add(okButton);
213 okCancelPanel.add(cancelButton);
214 lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
215 lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
217 namePanel.add(schemeName, java.awt.BorderLayout.CENTER);
218 namePanel.add(jLabel1, java.awt.BorderLayout.WEST);
219 panel1.add(namePanel, null);
220 panel1.add(buttonPanel, null);
221 panel1.add(casePanel);
222 casePanel.add(caseSensitive);
223 casePanel.add(lcaseColour);
224 panel1.add(lowerPanel, null);
227 jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
228 this.add(jPanel4, java.awt.BorderLayout.CENTER);
229 this.add(colorChooser, java.awt.BorderLayout.EAST);
238 protected void okButton_actionPerformed(ActionEvent e)
248 protected void applyButton_actionPerformed(ActionEvent e)
258 protected void loadbutton_actionPerformed(ActionEvent e)
268 protected void savebutton_actionPerformed(ActionEvent e)
278 protected void cancelButton_actionPerformed(ActionEvent e)
282 public void caseSensitive_actionPerformed(ActionEvent e)
287 public void lcaseColour_actionPerformed(ActionEvent e)