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