Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 14:43:25 GMT
  2. Package jalview.jbgui

File GUserDefinedColours.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
60% of files have more coverage

Code metrics

2
78
15
1
312
207
17
0.22
5.2
15
1.13

Classes

Class Line # Actions
GUserDefinedColours 53 78 17
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

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