2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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 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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.jbgui;
21 import jalview.gui.JvSwingUtils;
22 import jalview.util.MessageManager;
25 import java.awt.event.*;
34 public class GUserDefinedColours extends JPanel
36 protected JColorChooser colorChooser = new JColorChooser();
38 protected JPanel buttonPanel = new JPanel();
40 protected GridLayout gridLayout = new GridLayout();
42 JPanel lowerPanel = new JPanel();
44 protected JButton okButton = new JButton();
46 protected JButton applyButton = new JButton();
48 protected JButton loadbutton = new JButton();
50 protected JButton savebutton = new JButton();
52 protected JButton cancelButton = new JButton();
54 JPanel namePanel = new JPanel();
56 JLabel jLabel1 = new JLabel();
58 protected JTextField schemeName = new JTextField();
60 BorderLayout borderLayout1 = new BorderLayout();
62 JPanel panel1 = new JPanel();
64 JPanel okCancelPanel = new JPanel();
66 JPanel saveLoadPanel = new JPanel();
68 BorderLayout borderLayout3 = new BorderLayout();
70 GridBagLayout gridBagLayout1 = new GridBagLayout();
72 BorderLayout borderLayout2 = new BorderLayout();
74 FlowLayout flowLayout1 = new FlowLayout();
76 BorderLayout borderLayout4 = new BorderLayout();
78 JPanel jPanel4 = new JPanel();
80 BorderLayout borderLayout5 = new BorderLayout();
82 JLabel label = new JLabel();
84 protected JPanel casePanel = new JPanel();
86 protected JCheckBox caseSensitive = new JCheckBox();
88 protected JButton lcaseColour = new JButton();
91 * Creates a new GUserDefinedColours object.
93 public GUserDefinedColours()
111 private void jbInit() throws Exception
113 this.setLayout(borderLayout4);
114 buttonPanel.setLayout(gridLayout);
115 gridLayout.setColumns(4);
116 gridLayout.setRows(5);
117 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
118 okButton.setText(MessageManager.getString("action.ok"));
119 okButton.addActionListener(new java.awt.event.ActionListener()
121 public void actionPerformed(ActionEvent e)
123 okButton_actionPerformed(e);
126 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
127 applyButton.setText(MessageManager.getString("action.apply"));
128 applyButton.addActionListener(new java.awt.event.ActionListener()
130 public void actionPerformed(ActionEvent e)
132 applyButton_actionPerformed(e);
135 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
136 loadbutton.setText(MessageManager.getString("action.load_scheme"));
137 loadbutton.addActionListener(new java.awt.event.ActionListener()
139 public void actionPerformed(ActionEvent e)
141 loadbutton_actionPerformed(e);
144 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
145 savebutton.setText(MessageManager.getString("action.save_scheme"));
146 savebutton.addActionListener(new java.awt.event.ActionListener()
148 public void actionPerformed(ActionEvent e)
150 savebutton_actionPerformed(e);
153 cancelButton.setFont(JvSwingUtils.getLabelFont());
154 cancelButton.setText(MessageManager.getString("action.cancel"));
155 cancelButton.addActionListener(new java.awt.event.ActionListener()
157 public void actionPerformed(ActionEvent e)
159 cancelButton_actionPerformed(e);
162 this.setBackground(new Color(212, 208, 223));
163 lowerPanel.setOpaque(false);
164 lowerPanel.setLayout(borderLayout3);
165 colorChooser.setOpaque(false);
166 jLabel1.setFont(JvSwingUtils.getLabelFont());
167 jLabel1.setText(MessageManager.getString("label.name"));
168 namePanel.setMinimumSize(new Dimension(300, 31));
169 namePanel.setOpaque(false);
170 namePanel.setPreferredSize(new Dimension(240, 25));
171 namePanel.setLayout(borderLayout1);
172 schemeName.setFont(JvSwingUtils.getLabelFont());
173 schemeName.setPreferredSize(new Dimension(105, 21));
174 schemeName.setText("");
175 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
176 panel1.setLayout(flowLayout1);
177 panel1.setOpaque(false);
178 okCancelPanel.setOpaque(false);
179 saveLoadPanel.setOpaque(false);
180 jPanel4.setLayout(borderLayout5);
181 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
182 label.setOpaque(false);
183 label.setPreferredSize(new Dimension(260, 34));
184 label.setText(MessageManager.formatMessage("label.html_content", new String[]{MessageManager.getString("label.save_colour_scheme_with_unique_name_added_to_colour_menu")}));
185 caseSensitive.setText(MessageManager.getString("label.case_sensitive"));
186 caseSensitive.addActionListener(new ActionListener()
188 public void actionPerformed(ActionEvent e)
190 caseSensitive_actionPerformed(e);
193 lcaseColour.setText(MessageManager.getString("label.lower_case_colour"));
194 lcaseColour.addActionListener(new ActionListener()
196 public void actionPerformed(ActionEvent e)
198 lcaseColour_actionPerformed(e);
202 saveLoadPanel.add(savebutton);
203 saveLoadPanel.add(loadbutton);
204 okCancelPanel.add(applyButton);
205 okCancelPanel.add(okButton);
206 okCancelPanel.add(cancelButton);
207 lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
208 lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
210 namePanel.add(schemeName, java.awt.BorderLayout.CENTER);
211 namePanel.add(jLabel1, java.awt.BorderLayout.WEST);
212 panel1.add(namePanel, null);
213 panel1.add(buttonPanel, null);
214 panel1.add(casePanel);
215 casePanel.add(caseSensitive);
216 casePanel.add(lcaseColour);
217 panel1.add(lowerPanel, null);
220 jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
221 this.add(jPanel4, java.awt.BorderLayout.CENTER);
222 this.add(colorChooser, java.awt.BorderLayout.EAST);
231 protected void okButton_actionPerformed(ActionEvent e)
241 protected void applyButton_actionPerformed(ActionEvent e)
251 protected void loadbutton_actionPerformed(ActionEvent e)
261 protected void savebutton_actionPerformed(ActionEvent e)
271 protected void cancelButton_actionPerformed(ActionEvent e)
275 public void caseSensitive_actionPerformed(ActionEvent e)
280 public void lcaseColour_actionPerformed(ActionEvent e)