2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2005 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
20 package jalview.jbgui;
24 import java.awt.event.*;
26 public class GSliderPanel extends JPanel
28 // this is used for conservation colours, PID colours and redundancy threshold
29 protected JSlider slider = new JSlider();
30 protected JTextField valueField = new JTextField();
31 protected JLabel label = new JLabel();
32 JPanel jPanel1 = new JPanel();
33 GridLayout gridLayout1 = new GridLayout();
34 JPanel jPanel2 = new JPanel();
35 protected JButton applyButton = new JButton();
36 protected JButton undoButton = new JButton();
37 FlowLayout flowLayout1 = new FlowLayout();
38 protected JCheckBox allGroupsCheck = new JCheckBox();
39 BorderLayout borderLayout1 = new BorderLayout();
52 private void jbInit() throws Exception
54 this.setLayout(gridLayout1);
55 slider.setMajorTickSpacing(10);
56 slider.setMinorTickSpacing(1);
57 slider.setPaintTicks(true);
58 slider.setBackground(Color.white);
59 slider.setFont(new java.awt.Font("Verdana", 0, 11));
60 slider.setDoubleBuffered(true);
61 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
62 valueField.setMinimumSize(new Dimension(6, 14));
63 valueField.setPreferredSize(new Dimension(50, 12));
64 valueField.setText("");
65 valueField.setHorizontalAlignment(SwingConstants.CENTER);
66 valueField.addActionListener(new java.awt.event.ActionListener()
68 public void actionPerformed(ActionEvent e)
70 valueField_actionPerformed(e);
73 label.setFont(new java.awt.Font("Verdana", 0, 11));
74 label.setOpaque(false);
75 label.setHorizontalAlignment(SwingConstants.CENTER);
76 label.setText("set this label text");
77 jPanel1.setLayout(borderLayout1);
78 gridLayout1.setRows(2);
79 jPanel2.setLayout(flowLayout1);
80 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
81 applyButton.setOpaque(false);
82 applyButton.setText("Apply");
83 applyButton.addActionListener(new java.awt.event.ActionListener()
85 public void actionPerformed(ActionEvent e)
87 applyButton_actionPerformed(e);
90 undoButton.setEnabled(false);
91 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
92 undoButton.setOpaque(false);
93 undoButton.setText("Undo");
94 undoButton.addActionListener(new java.awt.event.ActionListener()
96 public void actionPerformed(ActionEvent e)
98 undoButton_actionPerformed(e);
101 allGroupsCheck.setEnabled(false);
102 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
103 allGroupsCheck.setOpaque(false);
104 allGroupsCheck.setText("Apply to all Groups");
105 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
107 public void actionPerformed(ActionEvent e)
109 allGroupsCheck_actionPerformed(e);
112 this.setBackground(Color.white);
113 this.setPreferredSize(new Dimension(415, 84));
114 jPanel2.setOpaque(false);
115 jPanel1.setOpaque(false);
116 this.add(jPanel2, null);
117 jPanel2.add(label, null);
118 jPanel2.add(applyButton, null);
119 jPanel2.add(undoButton, null);this.add(jPanel1, null);
120 jPanel1.add(slider, BorderLayout.WEST);
121 jPanel1.add(valueField, BorderLayout.CENTER);
122 jPanel1.add(allGroupsCheck, BorderLayout.EAST);
126 protected void valueField_actionPerformed(ActionEvent e)
131 protected void applyButton_actionPerformed(ActionEvent e)
136 protected void undoButton_actionPerformed(ActionEvent e)
141 protected void allGroupsCheck_actionPerformed(ActionEvent e)