2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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;
21 import jalview.util.MessageManager;
24 import java.awt.event.*;
33 public class GUserDefinedColours extends JPanel
35 protected JColorChooser colorChooser = new JColorChooser();
37 protected JPanel buttonPanel = new JPanel();
39 protected GridLayout gridLayout = new GridLayout();
41 JPanel lowerPanel = new JPanel();
43 protected JButton okButton = new JButton();
45 protected JButton applyButton = new JButton();
47 protected JButton loadbutton = new JButton();
49 protected JButton savebutton = new JButton();
51 protected JButton cancelButton = new JButton();
53 JPanel namePanel = new JPanel();
55 JLabel jLabel1 = new JLabel();
57 protected JTextField schemeName = new JTextField();
59 BorderLayout borderLayout1 = new BorderLayout();
61 JPanel panel1 = new JPanel();
63 JPanel okCancelPanel = new JPanel();
65 JPanel saveLoadPanel = new JPanel();
67 BorderLayout borderLayout3 = new BorderLayout();
69 GridBagLayout gridBagLayout1 = new GridBagLayout();
71 BorderLayout borderLayout2 = new BorderLayout();
73 FlowLayout flowLayout1 = new FlowLayout();
75 BorderLayout borderLayout4 = new BorderLayout();
77 JPanel jPanel4 = new JPanel();
79 BorderLayout borderLayout5 = new BorderLayout();
81 JLabel label = new JLabel();
83 protected JPanel casePanel = new JPanel();
85 protected JCheckBox caseSensitive = new JCheckBox();
87 protected JButton lcaseColour = new JButton();
90 * Creates a new GUserDefinedColours object.
92 public GUserDefinedColours()
110 private void jbInit() throws Exception
112 this.setLayout(borderLayout4);
113 buttonPanel.setLayout(gridLayout);
114 gridLayout.setColumns(4);
115 gridLayout.setRows(5);
116 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
117 okButton.setText(MessageManager.getString("action.ok"));
118 okButton.addActionListener(new java.awt.event.ActionListener()
120 public void actionPerformed(ActionEvent e)
122 okButton_actionPerformed(e);
125 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
126 applyButton.setText(MessageManager.getString("action.apply"));
127 applyButton.addActionListener(new java.awt.event.ActionListener()
129 public void actionPerformed(ActionEvent e)
131 applyButton_actionPerformed(e);
134 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
135 loadbutton.setText(MessageManager.getString("action.load_scheme"));
136 loadbutton.addActionListener(new java.awt.event.ActionListener()
138 public void actionPerformed(ActionEvent e)
140 loadbutton_actionPerformed(e);
143 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
144 savebutton.setText(MessageManager.getString("action.save_scheme"));
145 savebutton.addActionListener(new java.awt.event.ActionListener()
147 public void actionPerformed(ActionEvent e)
149 savebutton_actionPerformed(e);
152 cancelButton.setFont(JvSwingUtils.getLabelFont());
153 cancelButton.setText(MessageManager.getString("action.cancel"));
154 cancelButton.addActionListener(new java.awt.event.ActionListener()
156 public void actionPerformed(ActionEvent e)
158 cancelButton_actionPerformed(e);
161 this.setBackground(new Color(212, 208, 223));
162 lowerPanel.setOpaque(false);
163 lowerPanel.setLayout(borderLayout3);
164 colorChooser.setOpaque(false);
165 jLabel1.setFont(JvSwingUtils.getLabelFont());
166 jLabel1.setText(MessageManager.getString("label.name"));
167 namePanel.setMinimumSize(new Dimension(300, 31));
168 namePanel.setOpaque(false);
169 namePanel.setPreferredSize(new Dimension(240, 25));
170 namePanel.setLayout(borderLayout1);
171 schemeName.setFont(JvSwingUtils.getLabelFont());
172 schemeName.setPreferredSize(new Dimension(105, 21));
173 schemeName.setText("");
174 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
175 panel1.setLayout(flowLayout1);
176 panel1.setOpaque(false);
177 okCancelPanel.setOpaque(false);
178 saveLoadPanel.setOpaque(false);
179 jPanel4.setLayout(borderLayout5);
180 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
181 label.setOpaque(false);
182 label.setPreferredSize(new Dimension(260, 34));
183 label.setText(MessageManager.formatMessage("label.html_content", new String[]{MessageManager.getString("label.save_colour_scheme_with_unique_name_added_to_colour_menu")}));
184 caseSensitive.setText(MessageManager.getString("label.case_sensitive"));
185 caseSensitive.addActionListener(new ActionListener()
187 public void actionPerformed(ActionEvent e)
189 caseSensitive_actionPerformed(e);
192 lcaseColour.setText(MessageManager.getString("label.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)