2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.jbgui;
22 import java.awt.event.*;
25 import java.awt.BorderLayout;
33 public class GSliderPanel extends JPanel
35 // this is used for conservation colours, PID colours and redundancy threshold
36 protected JSlider slider = new JSlider();
37 protected JTextField valueField = new JTextField();
38 protected JLabel label = new JLabel();
39 protected JPanel southPanel = new JPanel();
40 GridLayout gridLayout1 = new GridLayout();
41 JPanel jPanel2 = new JPanel();
42 protected JButton applyButton = new JButton();
43 protected JButton undoButton = new JButton();
44 FlowLayout flowLayout1 = new FlowLayout();
45 protected JCheckBox allGroupsCheck = new JCheckBox();
46 BorderLayout borderLayout1 = new BorderLayout();
47 JPanel jPanel1 = new JPanel();
48 BorderLayout borderLayout2 = new BorderLayout();
51 * Creates a new GSliderPanel object.
68 * @throws Exception DOCUMENT ME!
70 private void jbInit() throws Exception
72 this.setLayout(gridLayout1);
73 slider.setMajorTickSpacing(10);
74 slider.setMinorTickSpacing(1);
75 slider.setPaintTicks(true);
76 slider.setBackground(Color.white);
77 slider.setFont(new java.awt.Font("Verdana", 0, 11));
78 slider.setDoubleBuffered(true);
79 slider.addMouseListener(new MouseAdapter()
81 public void mouseReleased(MouseEvent e)
83 slider_mouseReleased(e);
86 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
87 valueField.setMinimumSize(new Dimension(6, 14));
88 valueField.setPreferredSize(new Dimension(50, 12));
89 valueField.setText("");
90 valueField.setHorizontalAlignment(SwingConstants.CENTER);
91 valueField.addActionListener(new java.awt.event.ActionListener()
93 public void actionPerformed(ActionEvent e)
95 valueField_actionPerformed(e);
98 label.setFont(new java.awt.Font("Verdana", 0, 11));
99 label.setOpaque(false);
100 label.setHorizontalAlignment(SwingConstants.CENTER);
101 label.setText("set this label text");
102 southPanel.setLayout(borderLayout1);
103 gridLayout1.setRows(2);
104 jPanel2.setLayout(flowLayout1);
105 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
106 applyButton.setOpaque(false);
107 applyButton.setText("Apply");
108 applyButton.addActionListener(new java.awt.event.ActionListener()
110 public void actionPerformed(ActionEvent e)
112 applyButton_actionPerformed(e);
115 undoButton.setEnabled(false);
116 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
117 undoButton.setOpaque(false);
118 undoButton.setText("Undo");
119 undoButton.addActionListener(new java.awt.event.ActionListener()
121 public void actionPerformed(ActionEvent e)
123 undoButton_actionPerformed(e);
126 allGroupsCheck.setEnabled(false);
127 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
128 allGroupsCheck.setOpaque(false);
129 allGroupsCheck.setText("Apply to all Groups");
130 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
132 public void actionPerformed(ActionEvent e)
134 allGroupsCheck_actionPerformed(e);
137 this.setBackground(Color.white);
138 this.setPreferredSize(new Dimension(415, 84));
139 jPanel2.setOpaque(false);
140 southPanel.setOpaque(false);
141 jPanel1.setLayout(borderLayout2);
142 jPanel1.setOpaque(false);
143 this.add(jPanel2, null);
144 jPanel2.add(label, null);
145 jPanel2.add(applyButton, null);
146 jPanel2.add(undoButton, null);
147 this.add(southPanel, null);
148 southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
149 southPanel.add(slider, java.awt.BorderLayout.CENTER);
150 jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
151 jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
157 * @param e DOCUMENT ME!
159 protected void valueField_actionPerformed(ActionEvent e)
166 * @param e DOCUMENT ME!
168 protected void applyButton_actionPerformed(ActionEvent e)
175 * @param e DOCUMENT ME!
177 protected void undoButton_actionPerformed(ActionEvent e)
184 * @param e DOCUMENT ME!
186 protected void allGroupsCheck_actionPerformed(ActionEvent e)
190 public void slider_mouseReleased(MouseEvent e)