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