2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 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.*;
31 public class GSliderPanel extends JPanel
33 // this is used for conservation colours, PID colours and redundancy threshold
34 protected JSlider slider = new JSlider();
36 protected JTextField valueField = new JTextField();
38 protected JLabel label = new JLabel();
40 protected JPanel southPanel = new JPanel();
42 GridLayout gridLayout1 = new GridLayout();
44 JPanel jPanel2 = new JPanel();
46 protected JButton applyButton = new JButton();
48 protected JButton undoButton = new JButton();
50 FlowLayout flowLayout1 = new FlowLayout();
52 protected JCheckBox allGroupsCheck = new JCheckBox();
54 BorderLayout borderLayout1 = new BorderLayout();
56 JPanel jPanel1 = new JPanel();
58 BorderLayout borderLayout2 = new BorderLayout();
61 * Creates a new GSliderPanel object.
80 private void jbInit() throws Exception
82 this.setLayout(gridLayout1);
83 slider.setMajorTickSpacing(10);
84 slider.setMinorTickSpacing(1);
85 slider.setPaintTicks(true);
86 slider.setBackground(Color.white);
87 slider.setFont(new java.awt.Font("Verdana", 0, 11));
88 slider.setDoubleBuffered(true);
89 slider.addMouseListener(new MouseAdapter()
91 public void mouseReleased(MouseEvent e)
93 slider_mouseReleased(e);
96 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
97 valueField.setMinimumSize(new Dimension(6, 14));
98 valueField.setPreferredSize(new Dimension(50, 12));
99 valueField.setText("");
100 valueField.setHorizontalAlignment(SwingConstants.CENTER);
101 valueField.addActionListener(new java.awt.event.ActionListener()
103 public void actionPerformed(ActionEvent e)
105 valueField_actionPerformed(e);
108 label.setFont(new java.awt.Font("Verdana", 0, 11));
109 label.setOpaque(false);
110 label.setHorizontalAlignment(SwingConstants.CENTER);
111 label.setText("set this label text");
112 southPanel.setLayout(borderLayout1);
113 gridLayout1.setRows(2);
114 jPanel2.setLayout(flowLayout1);
115 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
116 applyButton.setOpaque(false);
117 applyButton.setText("Apply");
118 applyButton.addActionListener(new java.awt.event.ActionListener()
120 public void actionPerformed(ActionEvent e)
122 applyButton_actionPerformed(e);
125 undoButton.setEnabled(false);
126 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
127 undoButton.setOpaque(false);
128 undoButton.setText("Undo");
129 undoButton.addActionListener(new java.awt.event.ActionListener()
131 public void actionPerformed(ActionEvent e)
133 undoButton_actionPerformed(e);
136 allGroupsCheck.setEnabled(false);
137 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
138 allGroupsCheck.setOpaque(false);
139 allGroupsCheck.setText("Apply to all Groups");
140 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
142 public void actionPerformed(ActionEvent e)
144 allGroupsCheck_actionPerformed(e);
147 this.setBackground(Color.white);
148 this.setPreferredSize(new Dimension(415, 84));
149 jPanel2.setOpaque(false);
150 southPanel.setOpaque(false);
151 jPanel1.setLayout(borderLayout2);
152 jPanel1.setOpaque(false);
153 this.add(jPanel2, null);
154 jPanel2.add(label, null);
155 jPanel2.add(applyButton, null);
156 jPanel2.add(undoButton, null);
157 this.add(southPanel, null);
158 southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
159 southPanel.add(slider, java.awt.BorderLayout.CENTER);
160 jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
161 jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
170 protected void valueField_actionPerformed(ActionEvent e)
180 protected void applyButton_actionPerformed(ActionEvent e)
190 protected void undoButton_actionPerformed(ActionEvent e)
200 protected void allGroupsCheck_actionPerformed(ActionEvent e)
204 public void slider_mouseReleased(MouseEvent e)