elementAt instead of get for 1.1 compatibility
[jalview.git] / src / jalview / jbgui / GSliderPanel.java
1 /*\r
2 * Jalview - A Sequence Alignment Editor and Viewer\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4 *\r
5 * This program is free software; you can redistribute it and/or\r
6 * modify it under the terms of the GNU General Public License\r
7 * as published by the Free Software Foundation; either version 2\r
8 * of the License, or (at your option) any later version.\r
9 *\r
10 * This program is distributed in the hope that it will be useful,\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 * GNU General Public License for more details.\r
14 *\r
15 * You should have received a copy of the GNU General Public License\r
16 * along with this program; if not, write to the Free Software\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18 */\r
19 package jalview.jbgui;\r
20 \r
21 import java.awt.*;\r
22 import java.awt.event.*;\r
23 \r
24 import javax.swing.*;\r
25 import java.awt.BorderLayout;\r
26 \r
27 /**\r
28  * DOCUMENT ME!\r
29  *\r
30  * @author $author$\r
31  * @version $Revision$\r
32  */\r
33 public class GSliderPanel extends JPanel\r
34 {\r
35     // this is used for conservation colours, PID colours and redundancy threshold\r
36     protected JSlider slider = new JSlider();\r
37     protected JTextField valueField = new JTextField();\r
38     protected JLabel label = new JLabel();\r
39     protected JPanel southPanel = new JPanel();\r
40     GridLayout gridLayout1 = new GridLayout();\r
41     JPanel jPanel2 = new JPanel();\r
42     protected JButton applyButton = new JButton();\r
43     protected JButton undoButton = new JButton();\r
44     FlowLayout flowLayout1 = new FlowLayout();\r
45     protected JCheckBox allGroupsCheck = new JCheckBox();\r
46     BorderLayout borderLayout1 = new BorderLayout();\r
47   JPanel jPanel1 = new JPanel();\r
48   BorderLayout borderLayout2 = new BorderLayout();\r
49 \r
50   /**\r
51      * Creates a new GSliderPanel object.\r
52      */\r
53     public GSliderPanel()\r
54     {\r
55         try\r
56         {\r
57             jbInit();\r
58         }\r
59         catch (Exception e)\r
60         {\r
61             e.printStackTrace();\r
62         }\r
63     }\r
64 \r
65     /**\r
66      * DOCUMENT ME!\r
67      *\r
68      * @throws Exception DOCUMENT ME!\r
69      */\r
70     private void jbInit() throws Exception\r
71     {\r
72         this.setLayout(gridLayout1);\r
73         slider.setMajorTickSpacing(10);\r
74         slider.setMinorTickSpacing(1);\r
75         slider.setPaintTicks(true);\r
76         slider.setBackground(Color.white);\r
77         slider.setFont(new java.awt.Font("Verdana", 0, 11));\r
78         slider.setDoubleBuffered(true);\r
79     slider.addMouseListener(new MouseAdapter()\r
80     {\r
81       public void mouseReleased(MouseEvent e)\r
82       {\r
83         slider_mouseReleased(e);\r
84       }\r
85     });\r
86     valueField.setFont(new java.awt.Font("Verdana", 0, 11));\r
87         valueField.setMinimumSize(new Dimension(6, 14));\r
88         valueField.setPreferredSize(new Dimension(50, 12));\r
89         valueField.setText("");\r
90         valueField.setHorizontalAlignment(SwingConstants.CENTER);\r
91         valueField.addActionListener(new java.awt.event.ActionListener()\r
92             {\r
93                 public void actionPerformed(ActionEvent e)\r
94                 {\r
95                     valueField_actionPerformed(e);\r
96                 }\r
97             });\r
98         label.setFont(new java.awt.Font("Verdana", 0, 11));\r
99         label.setOpaque(false);\r
100         label.setHorizontalAlignment(SwingConstants.CENTER);\r
101         label.setText("set this label text");\r
102     southPanel.setLayout(borderLayout1);\r
103         gridLayout1.setRows(2);\r
104         jPanel2.setLayout(flowLayout1);\r
105         applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
106         applyButton.setOpaque(false);\r
107         applyButton.setText("Apply");\r
108         applyButton.addActionListener(new java.awt.event.ActionListener()\r
109             {\r
110                 public void actionPerformed(ActionEvent e)\r
111                 {\r
112                     applyButton_actionPerformed(e);\r
113                 }\r
114             });\r
115         undoButton.setEnabled(false);\r
116         undoButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
117         undoButton.setOpaque(false);\r
118         undoButton.setText("Undo");\r
119         undoButton.addActionListener(new java.awt.event.ActionListener()\r
120             {\r
121                 public void actionPerformed(ActionEvent e)\r
122                 {\r
123                     undoButton_actionPerformed(e);\r
124                 }\r
125             });\r
126         allGroupsCheck.setEnabled(false);\r
127         allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));\r
128         allGroupsCheck.setOpaque(false);\r
129         allGroupsCheck.setText("Apply to all Groups");\r
130         allGroupsCheck.addActionListener(new java.awt.event.ActionListener()\r
131             {\r
132                 public void actionPerformed(ActionEvent e)\r
133                 {\r
134                     allGroupsCheck_actionPerformed(e);\r
135                 }\r
136             });\r
137         this.setBackground(Color.white);\r
138         this.setPreferredSize(new Dimension(415, 84));\r
139         jPanel2.setOpaque(false);\r
140     southPanel.setOpaque(false);\r
141     jPanel1.setLayout(borderLayout2);\r
142     jPanel1.setOpaque(false);\r
143     this.add(jPanel2, null);\r
144         jPanel2.add(label, null);\r
145         jPanel2.add(applyButton, null);\r
146         jPanel2.add(undoButton, null);\r
147         this.add(southPanel, null);\r
148     southPanel.add(jPanel1, java.awt.BorderLayout.EAST);\r
149     southPanel.add(slider, java.awt.BorderLayout.CENTER);\r
150     jPanel1.add(valueField, java.awt.BorderLayout.CENTER);\r
151     jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);\r
152   }\r
153 \r
154     /**\r
155      * DOCUMENT ME!\r
156      *\r
157      * @param e DOCUMENT ME!\r
158      */\r
159     protected void valueField_actionPerformed(ActionEvent e)\r
160     {\r
161     }\r
162 \r
163     /**\r
164      * DOCUMENT ME!\r
165      *\r
166      * @param e DOCUMENT ME!\r
167      */\r
168     protected void applyButton_actionPerformed(ActionEvent e)\r
169     {\r
170     }\r
171 \r
172     /**\r
173      * DOCUMENT ME!\r
174      *\r
175      * @param e DOCUMENT ME!\r
176      */\r
177     protected void undoButton_actionPerformed(ActionEvent e)\r
178     {\r
179     }\r
180 \r
181     /**\r
182      * DOCUMENT ME!\r
183      *\r
184      * @param e DOCUMENT ME!\r
185      */\r
186     protected void allGroupsCheck_actionPerformed(ActionEvent e)\r
187     {\r
188     }\r
189 \r
190     public void slider_mouseReleased(MouseEvent e)\r
191     {\r
192 \r
193     }\r
194   }\r