b11fb7f6507ee5215c790fdcfefb9756bfed844c
[jalview.git] / src / jalview / jbgui / GSliderPanel.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 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.util.MessageManager;
24
25 import java.awt.*;
26 import java.awt.event.*;
27 import javax.swing.*;
28
29 /**
30  * DOCUMENT ME!
31  * 
32  * @author $author$
33  * @version $Revision$
34  */
35 public class GSliderPanel extends JPanel
36 {
37   // this is used for conservation colours, PID colours and redundancy threshold
38   protected JSlider slider = new JSlider();
39
40   protected JTextField valueField = new JTextField();
41
42   protected JLabel label = new JLabel();
43
44   protected JPanel southPanel = new JPanel();
45
46   GridLayout gridLayout1 = new GridLayout();
47
48   JPanel jPanel2 = new JPanel();
49
50   protected JButton applyButton = new JButton();
51
52   protected JButton undoButton = new JButton();
53
54   FlowLayout flowLayout1 = new FlowLayout();
55
56   protected JCheckBox allGroupsCheck = new JCheckBox();
57
58   BorderLayout borderLayout1 = new BorderLayout();
59
60   JPanel jPanel1 = new JPanel();
61
62   BorderLayout borderLayout2 = new BorderLayout();
63
64   /**
65    * Creates a new GSliderPanel object.
66    */
67   public GSliderPanel()
68   {
69     try
70     {
71       jbInit();
72     } catch (Exception e)
73     {
74       e.printStackTrace();
75     }
76   }
77
78   /**
79    * DOCUMENT ME!
80    * 
81    * @throws Exception
82    *           DOCUMENT ME!
83    */
84   private void jbInit() throws Exception
85   {
86     this.setLayout(gridLayout1);
87     slider.setMajorTickSpacing(10);
88     slider.setMinorTickSpacing(1);
89     slider.setPaintTicks(true);
90     slider.setBackground(Color.white);
91     slider.setFont(new java.awt.Font("Verdana", 0, 11));
92     slider.setDoubleBuffered(true);
93     slider.addMouseListener(new MouseAdapter()
94     {
95       public void mouseReleased(MouseEvent e)
96       {
97         slider_mouseReleased(e);
98       }
99     });
100     valueField.setFont(new java.awt.Font("Verdana", 0, 11));
101     valueField.setMinimumSize(new Dimension(6, 14));
102     valueField.setPreferredSize(new Dimension(50, 12));
103     valueField.setText("");
104     valueField.setHorizontalAlignment(SwingConstants.CENTER);
105     valueField.addActionListener(new java.awt.event.ActionListener()
106     {
107       public void actionPerformed(ActionEvent e)
108       {
109         valueField_actionPerformed(e);
110       }
111     });
112     label.setFont(new java.awt.Font("Verdana", 0, 11));
113     label.setOpaque(false);
114     label.setHorizontalAlignment(SwingConstants.CENTER);
115     label.setText(MessageManager.getString("label.set_this_label_text"));
116     southPanel.setLayout(borderLayout1);
117     gridLayout1.setRows(2);
118     jPanel2.setLayout(flowLayout1);
119     applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
120     applyButton.setOpaque(false);
121     applyButton.setText(MessageManager.getString("action.apply"));
122     applyButton.addActionListener(new java.awt.event.ActionListener()
123     {
124       public void actionPerformed(ActionEvent e)
125       {
126         applyButton_actionPerformed(e);
127       }
128     });
129     undoButton.setEnabled(false);
130     undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
131     undoButton.setOpaque(false);
132     undoButton.setText(MessageManager.getString("action.undo"));
133     undoButton.addActionListener(new java.awt.event.ActionListener()
134     {
135       public void actionPerformed(ActionEvent e)
136       {
137         undoButton_actionPerformed(e);
138       }
139     });
140     allGroupsCheck.setEnabled(false);
141     allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
142     allGroupsCheck.setOpaque(false);
143     allGroupsCheck.setText(MessageManager
144             .getString("action.apply_all_groups"));
145     allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
146     {
147       public void actionPerformed(ActionEvent e)
148       {
149         allGroupsCheck_actionPerformed(e);
150       }
151     });
152     this.setBackground(Color.white);
153     this.setPreferredSize(new Dimension(415, 84));
154     jPanel2.setOpaque(false);
155     southPanel.setOpaque(false);
156     jPanel1.setLayout(borderLayout2);
157     jPanel1.setOpaque(false);
158     this.add(jPanel2, null);
159     jPanel2.add(label, null);
160     jPanel2.add(applyButton, null);
161     jPanel2.add(undoButton, null);
162     this.add(southPanel, null);
163     southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
164     southPanel.add(slider, java.awt.BorderLayout.CENTER);
165     jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
166     jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
167   }
168
169   /**
170    * DOCUMENT ME!
171    * 
172    * @param e
173    *          DOCUMENT ME!
174    */
175   protected void valueField_actionPerformed(ActionEvent e)
176   {
177   }
178
179   /**
180    * DOCUMENT ME!
181    * 
182    * @param e
183    *          DOCUMENT ME!
184    */
185   protected void applyButton_actionPerformed(ActionEvent e)
186   {
187   }
188
189   /**
190    * DOCUMENT ME!
191    * 
192    * @param e
193    *          DOCUMENT ME!
194    */
195   protected void undoButton_actionPerformed(ActionEvent e)
196   {
197   }
198
199   /**
200    * DOCUMENT ME!
201    * 
202    * @param e
203    *          DOCUMENT ME!
204    */
205   protected void allGroupsCheck_actionPerformed(ActionEvent e)
206   {
207   }
208
209   public void slider_mouseReleased(MouseEvent e)
210   {
211
212   }
213 }