Class |
Line # |
Actions |
|||
---|---|---|---|---|---|
GUserDefinedColours | 54 | 78 | 17 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
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. | |
11 | * | |
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. | |
16 | * | |
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. | |
20 | */ | |
21 | package jalview.jbgui; | |
22 | ||
23 | import jalview.bin.Jalview; | |
24 | import jalview.gui.JvSwingUtils; | |
25 | import jalview.util.MessageManager; | |
26 | ||
27 | import java.awt.BorderLayout; | |
28 | import java.awt.Color; | |
29 | import java.awt.Dimension; | |
30 | import java.awt.FlowLayout; | |
31 | import java.awt.Font; | |
32 | import java.awt.GridBagLayout; | |
33 | import java.awt.GridLayout; | |
34 | import java.awt.event.ActionEvent; | |
35 | import java.awt.event.ActionListener; | |
36 | import java.util.ArrayList; | |
37 | import java.util.List; | |
38 | ||
39 | import javax.swing.JButton; | |
40 | import javax.swing.JCheckBox; | |
41 | import javax.swing.JColorChooser; | |
42 | import javax.swing.JLabel; | |
43 | import javax.swing.JPanel; | |
44 | import javax.swing.JTextField; | |
45 | import javax.swing.SwingConstants; | |
46 | import javax.swing.colorchooser.AbstractColorChooserPanel; | |
47 | ||
48 | /** | |
49 | * DOCUMENT ME! | |
50 | * | |
51 | * @author $author$ | |
52 | * @version $Revision$ | |
53 | */ | |
54 | public class GUserDefinedColours extends JPanel | |
55 | { | |
56 | protected JColorChooser colorChooser = new JColorChooser(); | |
57 | ||
58 | protected JPanel buttonPanel = new JPanel(); | |
59 | ||
60 | protected GridLayout gridLayout = new GridLayout(); | |
61 | ||
62 | JPanel lowerPanel = new JPanel(); | |
63 | ||
64 | protected JButton okButton = new JButton(); | |
65 | ||
66 | protected JButton applyButton = new JButton(); | |
67 | ||
68 | protected JButton loadbutton = new JButton(); | |
69 | ||
70 | protected JButton savebutton = new JButton(); | |
71 | ||
72 | protected JButton cancelButton = new JButton(); | |
73 | ||
74 | JPanel namePanel = new JPanel(); | |
75 | ||
76 | JLabel jLabel1 = new JLabel(); | |
77 | ||
78 | public JTextField schemeName = new JTextField(); | |
79 | ||
80 | BorderLayout borderLayout1 = new BorderLayout(); | |
81 | ||
82 | JPanel panel1 = new JPanel(); | |
83 | ||
84 | JPanel okCancelPanel = new JPanel(); | |
85 | ||
86 | JPanel saveLoadPanel = new JPanel(); | |
87 | ||
88 | BorderLayout borderLayout3 = new BorderLayout(); | |
89 | ||
90 | GridBagLayout gridBagLayout1 = new GridBagLayout(); | |
91 | ||
92 | BorderLayout borderLayout2 = new BorderLayout(); | |
93 | ||
94 | FlowLayout flowLayout1 = new FlowLayout(); | |
95 | ||
96 | BorderLayout borderLayout4 = new BorderLayout(); | |
97 | ||
98 | JPanel jPanel4 = new JPanel(); | |
99 | ||
100 | BorderLayout borderLayout5 = new BorderLayout(); | |
101 | ||
102 | JLabel label = new JLabel(); | |
103 | ||
104 | protected JPanel casePanel = new JPanel(); | |
105 | ||
106 | public JCheckBox caseSensitive = new JCheckBox(); | |
107 | ||
108 | public JCheckBox lcaseColour = new JCheckBox(); | |
109 | ||
110 | protected List<JButton> selectedButtons; | |
111 | ||
112 | /** | |
113 | * Creates a new GUserDefinedColours object. | |
114 | */ | |
115 | 0 | public GUserDefinedColours() |
116 | { | |
117 | 0 | try |
118 | { | |
119 | 0 | jbInit(); |
120 | } catch (Exception e) | |
121 | { | |
122 | 0 | e.printStackTrace(); |
123 | } | |
124 | ||
125 | } | |
126 | ||
127 | /** | |
128 | * DOCUMENT ME! | |
129 | * | |
130 | * @throws Exception | |
131 | * DOCUMENT ME! | |
132 | */ | |
133 | 0 | private void jbInit() throws Exception |
134 | { | |
135 | 0 | this.setLayout(borderLayout4); |
136 | 0 | buttonPanel.setLayout(gridLayout); |
137 | 0 | gridLayout.setColumns(4); |
138 | 0 | gridLayout.setRows(5); |
139 | 0 | okButton.setFont(new java.awt.Font("Verdana", 0, 11)); |
140 | 0 | okButton.setText(MessageManager.getString("action.ok")); |
141 | 0 | okButton.addActionListener(new ActionListener() |
142 | { | |
143 | 0 | @Override |
144 | public void actionPerformed(ActionEvent e) | |
145 | { | |
146 | 0 | okButton_actionPerformed(); |
147 | } | |
148 | }); | |
149 | 0 | applyButton.setFont(new java.awt.Font("Verdana", 0, 11)); |
150 | 0 | applyButton.setText(MessageManager.getString("action.apply")); |
151 | 0 | applyButton.addActionListener(new ActionListener() |
152 | { | |
153 | 0 | @Override |
154 | public void actionPerformed(ActionEvent e) | |
155 | { | |
156 | 0 | applyButton_actionPerformed(); |
157 | } | |
158 | }); | |
159 | 0 | loadbutton.setFont(new java.awt.Font("Verdana", 0, 11)); |
160 | 0 | loadbutton.setText(MessageManager.getString("action.load_scheme")); |
161 | 0 | loadbutton.addActionListener(new ActionListener() |
162 | { | |
163 | 0 | @Override |
164 | public void actionPerformed(ActionEvent e) | |
165 | { | |
166 | 0 | loadbutton_actionPerformed(); |
167 | } | |
168 | }); | |
169 | 0 | savebutton.setFont(new java.awt.Font("Verdana", 0, 11)); |
170 | 0 | savebutton.setText(MessageManager.getString("action.save_scheme")); |
171 | 0 | savebutton.addActionListener(new ActionListener() |
172 | { | |
173 | 0 | @Override |
174 | public void actionPerformed(ActionEvent e) | |
175 | { | |
176 | 0 | savebutton_actionPerformed(); |
177 | } | |
178 | }); | |
179 | 0 | cancelButton.setFont(JvSwingUtils.getLabelFont()); |
180 | 0 | cancelButton.setText(MessageManager.getString("action.cancel")); |
181 | 0 | cancelButton.addActionListener(new ActionListener() |
182 | { | |
183 | 0 | @Override |
184 | public void actionPerformed(ActionEvent e) | |
185 | { | |
186 | 0 | cancelButton_actionPerformed(); |
187 | } | |
188 | }); | |
189 | 0 | this.setBackground(new Color(212, 208, 223)); |
190 | 0 | lowerPanel.setOpaque(false); |
191 | 0 | lowerPanel.setLayout(borderLayout3); |
192 | 0 | colorChooser.setOpaque(false); |
193 | 0 | jLabel1.setFont(JvSwingUtils.getLabelFont()); |
194 | 0 | jLabel1.setText(MessageManager.getString("label.name")); |
195 | 0 | namePanel.setMinimumSize(new Dimension(300, 31)); |
196 | 0 | namePanel.setOpaque(false); |
197 | 0 | namePanel.setPreferredSize(new Dimension(240, 25)); |
198 | 0 | namePanel.setLayout(borderLayout1); |
199 | 0 | schemeName.setFont(JvSwingUtils.getLabelFont()); |
200 | 0 | schemeName.setPreferredSize(new Dimension(105, 21)); |
201 | 0 | schemeName.setText(""); |
202 | 0 | schemeName.setHorizontalAlignment(SwingConstants.CENTER); |
203 | 0 | panel1.setLayout(flowLayout1); |
204 | 0 | panel1.setOpaque(false); |
205 | 0 | okCancelPanel.setOpaque(false); |
206 | 0 | saveLoadPanel.setOpaque(false); |
207 | 0 | jPanel4.setLayout(borderLayout5); |
208 | 0 | label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10)); |
209 | 0 | label.setOpaque(false); |
210 | 0 | label.setPreferredSize(new Dimension(260, 34)); |
211 | 0 | label.setText( |
212 | MessageManager.formatMessage("label.html_content", new String[] | |
213 | { MessageManager.getString( | |
214 | "label.save_colour_scheme_with_unique_name_added_to_colour_menu") })); | |
215 | 0 | caseSensitive.setText(MessageManager.getString("label.case_sensitive")); |
216 | 0 | caseSensitive.addActionListener(new ActionListener() |
217 | { | |
218 | 0 | @Override |
219 | public void actionPerformed(ActionEvent e) | |
220 | { | |
221 | 0 | caseSensitive_actionPerformed(); |
222 | } | |
223 | }); | |
224 | 0 | lcaseColour |
225 | .setText(MessageManager.getString("label.lower_case_colour")); | |
226 | 0 | lcaseColour.setToolTipText( |
227 | MessageManager.getString("label.lower_case_tip")); | |
228 | ||
229 | 0 | saveLoadPanel.add(savebutton); |
230 | 0 | saveLoadPanel.add(loadbutton); |
231 | 0 | okCancelPanel.add(applyButton); |
232 | 0 | okCancelPanel.add(okButton); |
233 | 0 | okCancelPanel.add(cancelButton); |
234 | 0 | lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH); |
235 | 0 | lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH); |
236 | ||
237 | 0 | namePanel.add(schemeName, java.awt.BorderLayout.CENTER); |
238 | 0 | namePanel.add(jLabel1, java.awt.BorderLayout.WEST); |
239 | 0 | panel1.add(namePanel, null); |
240 | 0 | panel1.add(buttonPanel, null); |
241 | 0 | panel1.add(casePanel); |
242 | 0 | casePanel.add(caseSensitive); |
243 | 0 | casePanel.add(lcaseColour); |
244 | 0 | panel1.add(lowerPanel, null); |
245 | 0 | panel1.add(label); |
246 | ||
247 | 0 | jPanel4.add(panel1, java.awt.BorderLayout.CENTER); |
248 | 0 | this.add(jPanel4, java.awt.BorderLayout.CENTER); |
249 | 0 | this.add(colorChooser, java.awt.BorderLayout.EAST); |
250 | ||
251 | 0 | AbstractColorChooserPanel[] choosers = colorChooser.getChooserPanels(); |
252 | // JAL-1360 larger JColorChooser in Java 7 overwrites AA panel; restrict to | |
253 | // swatch picker only | |
254 | 0 | if (choosers.length > 3) |
255 | { | |
256 | // Java 7 default has 5 options rather than 3 for choosing colours; keep | |
257 | // the first only | |
258 | 0 | colorChooser |
259 | .setChooserPanels(new AbstractColorChooserPanel[] | |
260 | { choosers[0] }); | |
261 | } | |
262 | ||
263 | 0 | selectedButtons = new ArrayList<JButton>(); |
264 | } | |
265 | ||
266 | /** | |
267 | * DOCUMENT ME! | |
268 | */ | |
269 | 0 | protected void okButton_actionPerformed() |
270 | { | |
271 | } | |
272 | ||
273 | /** | |
274 | * DOCUMENT ME! | |
275 | */ | |
276 | 0 | protected void applyButton_actionPerformed() |
277 | { | |
278 | } | |
279 | ||
280 | /** | |
281 | * DOCUMENT ME! | |
282 | * | |
283 | * @param e | |
284 | * DOCUMENT ME! | |
285 | */ | |
286 | 0 | protected void loadbutton_actionPerformed() |
287 | { | |
288 | } | |
289 | ||
290 | 0 | protected void savebutton_actionPerformed() |
291 | { | |
292 | } | |
293 | ||
294 | /** | |
295 | * DOCUMENT ME! | |
296 | * | |
297 | * @param e | |
298 | * DOCUMENT ME! | |
299 | */ | |
300 | 0 | protected void cancelButton_actionPerformed() |
301 | { | |
302 | } | |
303 | ||
304 | 0 | public void caseSensitive_actionPerformed() |
305 | { | |
306 | ||
307 | } | |
308 | ||
309 | 0 | public void lcaseColour_actionPerformed() |
310 | { | |
311 | ||
312 | } | |
313 | } |