2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.jbgui;
22 import java.awt.event.*;
25 import java.awt.Dimension;
33 public class GUserDefinedColours extends JPanel
35 protected JColorChooser colorChooser = new JColorChooser();
36 protected JPanel buttonPanel = new JPanel();
37 protected GridLayout gridLayout = new GridLayout();
38 JPanel lowerPanel = new JPanel();
39 protected JButton okButton = new JButton();
40 protected JButton applyButton = new JButton();
41 protected JButton loadbutton = new JButton();
42 protected JButton savebutton = new JButton();
43 protected JButton cancelButton = new JButton();
44 JPanel namePanel = new JPanel();
45 JLabel jLabel1 = new JLabel();
46 protected JTextField schemeName = new JTextField();
47 BorderLayout borderLayout1 = new BorderLayout();
48 JPanel panel1 = new JPanel();
49 JPanel okCancelPanel = new JPanel();
50 JPanel saveLoadPanel = new JPanel();
51 BorderLayout borderLayout3 = new BorderLayout();
52 GridBagLayout gridBagLayout1 = new GridBagLayout();
53 BorderLayout borderLayout2 = new BorderLayout();
54 FlowLayout flowLayout1 = new FlowLayout();
55 BorderLayout borderLayout4 = new BorderLayout();
56 JPanel jPanel4 = new JPanel();
57 BorderLayout borderLayout5 = new BorderLayout();
58 JLabel label = new JLabel();
59 JPanel casePanel = new JPanel();
60 protected JCheckBox caseSensitive = new JCheckBox();
61 protected JButton lcaseColour = new JButton();
63 * Creates a new GUserDefinedColours object.
65 public GUserDefinedColours()
80 * @throws Exception DOCUMENT ME!
82 private void jbInit() throws Exception
84 this.setLayout(borderLayout4);
85 buttonPanel.setLayout(gridLayout);
86 gridLayout.setColumns(4);
87 gridLayout.setRows(5);
88 okButton.setFont(new java.awt.Font("Verdana", 0, 11));
89 okButton.setText("OK");
90 okButton.addActionListener(new java.awt.event.ActionListener()
92 public void actionPerformed(ActionEvent e)
94 okButton_actionPerformed(e);
97 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
98 applyButton.setText("Apply");
99 applyButton.addActionListener(new java.awt.event.ActionListener()
101 public void actionPerformed(ActionEvent e)
103 applyButton_actionPerformed(e);
106 loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));
107 loadbutton.setText("Load scheme");
108 loadbutton.addActionListener(new java.awt.event.ActionListener()
110 public void actionPerformed(ActionEvent e)
112 loadbutton_actionPerformed(e);
115 savebutton.setFont(new java.awt.Font("Verdana", 0, 11));
116 savebutton.setText("Save scheme");
117 savebutton.addActionListener(new java.awt.event.ActionListener()
119 public void actionPerformed(ActionEvent e)
121 savebutton_actionPerformed(e);
124 cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));
125 cancelButton.setText("Cancel");
126 cancelButton.addActionListener(new java.awt.event.ActionListener()
128 public void actionPerformed(ActionEvent e)
130 cancelButton_actionPerformed(e);
133 this.setBackground(new Color(212, 208, 223));
134 lowerPanel.setOpaque(false);
135 lowerPanel.setLayout(borderLayout3);
136 colorChooser.setOpaque(false);
137 jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
138 jLabel1.setText("Name");
139 namePanel.setMinimumSize(new Dimension(300, 31));
140 namePanel.setOpaque(false);
141 namePanel.setPreferredSize(new Dimension(240, 25));
142 namePanel.setToolTipText("");
143 namePanel.setLayout(borderLayout1);
144 schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
145 schemeName.setPreferredSize(new Dimension(105, 21));
146 schemeName.setText("");
147 schemeName.setHorizontalAlignment(SwingConstants.CENTER);
148 panel1.setLayout(flowLayout1);
149 panel1.setOpaque(false);
150 okCancelPanel.setOpaque(false);
151 saveLoadPanel.setOpaque(false);
152 jPanel4.setLayout(borderLayout5);
153 label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));
154 label.setOpaque(false);
155 label.setPreferredSize(new Dimension(260, 34));
157 "<html>Save your colour scheme with a unique name and it will be added " +
158 "to the Colour menu.</html>");
159 caseSensitive.setText("Case Sensitive");
160 caseSensitive.addActionListener(new ActionListener()
162 public void actionPerformed(ActionEvent e)
164 caseSensitive_actionPerformed(e);
167 lcaseColour.setText("Lower Case Colour");
168 lcaseColour.addActionListener(new ActionListener()
170 public void actionPerformed(ActionEvent e)
172 lcaseColour_actionPerformed(e);
176 saveLoadPanel.add(savebutton);
177 saveLoadPanel.add(loadbutton);
178 okCancelPanel.add(applyButton);
179 okCancelPanel.add(okButton);
180 okCancelPanel.add(cancelButton);
181 lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
182 lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
184 namePanel.add(schemeName, java.awt.BorderLayout.CENTER);
185 namePanel.add(jLabel1, java.awt.BorderLayout.WEST);
186 panel1.add(namePanel, null);
187 panel1.add(buttonPanel, null);
188 panel1.add(casePanel);
189 casePanel.add(caseSensitive);
190 casePanel.add(lcaseColour);
191 panel1.add(lowerPanel, null);
194 jPanel4.add(panel1, java.awt.BorderLayout.CENTER);
195 this.add(jPanel4, java.awt.BorderLayout.CENTER);
196 this.add(colorChooser, java.awt.BorderLayout.EAST);
202 * @param e DOCUMENT ME!
204 protected void okButton_actionPerformed(ActionEvent e)
211 * @param e DOCUMENT ME!
213 protected void applyButton_actionPerformed(ActionEvent e)
220 * @param e DOCUMENT ME!
222 protected void loadbutton_actionPerformed(ActionEvent e)
229 * @param e DOCUMENT ME!
231 protected void savebutton_actionPerformed(ActionEvent e)
238 * @param e DOCUMENT ME!
240 protected void cancelButton_actionPerformed(ActionEvent e)
244 public void caseSensitive_actionPerformed(ActionEvent e)
249 public void lcaseColour_actionPerformed(ActionEvent e)