2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5.1)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, 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;
21 import java.awt.event.*;
30 public class GUserDefinedColours extends JPanel
32 protected JColorChooser colorChooser = new JColorChooser();
34 protected JPanel buttonPanel = new JPanel();
36 protected GridLayout gridLayout = new GridLayout();
38 JPanel lowerPanel = new JPanel();
40 protected JButton okButton = new JButton();
42 protected JButton applyButton = new JButton();
44 protected JButton loadbutton = new JButton();
46 protected JButton savebutton = new JButton();
48 protected JButton cancelButton = new JButton();
50 JPanel namePanel = new JPanel();
52 JLabel jLabel1 = new JLabel();
54 protected JTextField schemeName = new JTextField();
56 BorderLayout borderLayout1 = new BorderLayout();
58 JPanel panel1 = new JPanel();
60 JPanel okCancelPanel = new JPanel();
62 JPanel saveLoadPanel = new JPanel();
64 BorderLayout borderLayout3 = new BorderLayout();
66 GridBagLayout gridBagLayout1 = new GridBagLayout();
68 BorderLayout borderLayout2 = new BorderLayout();
70 FlowLayout flowLayout1 = new FlowLayout();
72 BorderLayout borderLayout4 = new BorderLayout();
74 JPanel jPanel4 = new JPanel();
76 BorderLayout borderLayout5 = new BorderLayout();
78 JLabel label = new JLabel();
80 protected JPanel casePanel = new JPanel();
82 protected JCheckBox caseSensitive = new JCheckBox();
84 protected JButton lcaseColour = new JButton();
87 * Creates a new GUserDefinedColours object.
89 public GUserDefinedColours()
107 private void jbInit() throws Exception
109 this.setLayout(borderLayout4);
110 buttonPanel.setLayout(gridLayout);
111 gridLayout.setColumns(4);
112 gridLayout.setRows(5);
113 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
114 okButton.setText("OK");
115 okButton.addActionListener(new java.awt.event.ActionListener()
117 public void actionPerformed(ActionEvent e)
119 okButton_actionPerformed(e);
122 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
123 applyButton.setText("Apply");
124 applyButton.addActionListener(new java.awt.event.ActionListener()
126 public void actionPerformed(ActionEvent e)
128 applyButton_actionPerformed(e);
131 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
132 loadbutton.setText("Load scheme");
133 loadbutton.addActionListener(new java.awt.event.ActionListener()
135 public void actionPerformed(ActionEvent e)
137 loadbutton_actionPerformed(e);
140 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
141 savebutton.setText("Save scheme");
142 savebutton.addActionListener(new java.awt.event.ActionListener()
144 public void actionPerformed(ActionEvent e)
146 savebutton_actionPerformed(e);
149 cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));
150 cancelButton.setText("Cancel");
151 cancelButton.addActionListener(new java.awt.event.ActionListener()
153 public void actionPerformed(ActionEvent e)
155 cancelButton_actionPerformed(e);
158 this.setBackground(new Color(212, 208, 223));
159 lowerPanel.setOpaque(false);
160 lowerPanel.setLayout(borderLayout3);
161 colorChooser.setOpaque(false);
162 jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
163 jLabel1.setText("Name");
164 namePanel.setMinimumSize(new Dimension(300, 31));
165 namePanel.setOpaque(false);
166 namePanel.setPreferredSize(new Dimension(240, 25));
167 namePanel.setLayout(borderLayout1);
168 schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
169 schemeName.setPreferredSize(new Dimension(105, 21));
170 schemeName.setText("");
171 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
172 panel1.setLayout(flowLayout1);
173 panel1.setOpaque(false);
174 okCancelPanel.setOpaque(false);
175 saveLoadPanel.setOpaque(false);
176 jPanel4.setLayout(borderLayout5);
177 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
178 label.setOpaque(false);
179 label.setPreferredSize(new Dimension(260, 34));
181 .setText("<html>Save your colour scheme with a unique name and it will be added "
182 + "to the Colour menu.</html>");
183 caseSensitive.setText("Case Sensitive");
184 caseSensitive.addActionListener(new ActionListener()
186 public void actionPerformed(ActionEvent e)
188 caseSensitive_actionPerformed(e);
191 lcaseColour.setText("Lower Case Colour");
192 lcaseColour.addActionListener(new ActionListener()
194 public void actionPerformed(ActionEvent e)
196 lcaseColour_actionPerformed(e);
200 saveLoadPanel.add(savebutton);
201 saveLoadPanel.add(loadbutton);
202 okCancelPanel.add(applyButton);
203 okCancelPanel.add(okButton);
204 okCancelPanel.add(cancelButton);
205 lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
206 lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
208 namePanel.add(schemeName, java.awt.BorderLayout.CENTER);
209 namePanel.add(jLabel1, java.awt.BorderLayout.WEST);
210 panel1.add(namePanel, null);
211 panel1.add(buttonPanel, null);
212 panel1.add(casePanel);
213 casePanel.add(caseSensitive);
214 casePanel.add(lcaseColour);
215 panel1.add(lowerPanel, null);
218 jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
219 this.add(jPanel4, java.awt.BorderLayout.CENTER);
220 this.add(colorChooser, java.awt.BorderLayout.EAST);
229 protected void okButton_actionPerformed(ActionEvent e)
239 protected void applyButton_actionPerformed(ActionEvent e)
249 protected void loadbutton_actionPerformed(ActionEvent e)
259 protected void savebutton_actionPerformed(ActionEvent e)
269 protected void cancelButton_actionPerformed(ActionEvent e)
273 public void caseSensitive_actionPerformed(ActionEvent e)
278 public void lcaseColour_actionPerformed(ActionEvent e)