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