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
19 package jalview.jbgui;
\r
22 import java.awt.event.*;
\r
24 import javax.swing.*;
\r
27 public class GSliderPanel extends JPanel {
\r
28 // this is used for conservation colours, PID colours and redundancy threshold
\r
29 protected JSlider slider = new JSlider();
\r
30 protected JTextField valueField = new JTextField();
\r
31 protected JLabel label = new JLabel();
\r
32 JPanel jPanel1 = new JPanel();
\r
33 GridLayout gridLayout1 = new GridLayout();
\r
34 JPanel jPanel2 = new JPanel();
\r
35 protected JButton applyButton = new JButton();
\r
36 protected JButton undoButton = new JButton();
\r
37 FlowLayout flowLayout1 = new FlowLayout();
\r
38 protected JCheckBox allGroupsCheck = new JCheckBox();
\r
39 BorderLayout borderLayout1 = new BorderLayout();
\r
41 public GSliderPanel() {
\r
44 } catch (Exception e) {
\r
45 e.printStackTrace();
\r
49 private void jbInit() throws Exception {
\r
50 this.setLayout(gridLayout1);
\r
51 slider.setMajorTickSpacing(10);
\r
52 slider.setMinorTickSpacing(1);
\r
53 slider.setPaintTicks(true);
\r
54 slider.setBackground(Color.white);
\r
55 slider.setFont(new java.awt.Font("Verdana", 0, 11));
\r
56 slider.setDoubleBuffered(true);
\r
57 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
\r
58 valueField.setMinimumSize(new Dimension(6, 14));
\r
59 valueField.setPreferredSize(new Dimension(50, 12));
\r
60 valueField.setText("");
\r
61 valueField.setHorizontalAlignment(SwingConstants.CENTER);
\r
62 valueField.addActionListener(new java.awt.event.ActionListener() {
\r
63 public void actionPerformed(ActionEvent e) {
\r
64 valueField_actionPerformed(e);
\r
67 label.setFont(new java.awt.Font("Verdana", 0, 11));
\r
68 label.setOpaque(false);
\r
69 label.setHorizontalAlignment(SwingConstants.CENTER);
\r
70 label.setText("set this label text");
\r
71 jPanel1.setLayout(borderLayout1);
\r
72 gridLayout1.setRows(2);
\r
73 jPanel2.setLayout(flowLayout1);
\r
74 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
\r
75 applyButton.setOpaque(false);
\r
76 applyButton.setText("Apply");
\r
77 applyButton.addActionListener(new java.awt.event.ActionListener() {
\r
78 public void actionPerformed(ActionEvent e) {
\r
79 applyButton_actionPerformed(e);
\r
82 undoButton.setEnabled(false);
\r
83 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
\r
84 undoButton.setOpaque(false);
\r
85 undoButton.setText("Undo");
\r
86 undoButton.addActionListener(new java.awt.event.ActionListener() {
\r
87 public void actionPerformed(ActionEvent e) {
\r
88 undoButton_actionPerformed(e);
\r
91 allGroupsCheck.setEnabled(false);
\r
92 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
\r
93 allGroupsCheck.setOpaque(false);
\r
94 allGroupsCheck.setText("Apply to all Groups");
\r
95 allGroupsCheck.addActionListener(new java.awt.event.ActionListener() {
\r
96 public void actionPerformed(ActionEvent e) {
\r
97 allGroupsCheck_actionPerformed(e);
\r
100 this.setBackground(Color.white);
\r
101 this.setPreferredSize(new Dimension(415, 84));
\r
102 jPanel2.setOpaque(false);
\r
103 jPanel1.setOpaque(false);
\r
104 this.add(jPanel2, null);
\r
105 jPanel2.add(label, null);
\r
106 jPanel2.add(applyButton, null);
\r
107 jPanel2.add(undoButton, null);
\r
108 this.add(jPanel1, null);
\r
109 jPanel1.add(slider, BorderLayout.WEST);
\r
110 jPanel1.add(valueField, BorderLayout.CENTER);
\r
111 jPanel1.add(allGroupsCheck, BorderLayout.EAST);
\r
114 protected void valueField_actionPerformed(ActionEvent e) {
\r
117 protected void applyButton_actionPerformed(ActionEvent e) {
\r
120 protected void undoButton_actionPerformed(ActionEvent e) {
\r
123 protected void allGroupsCheck_actionPerformed(ActionEvent e) {
\r