2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.jbgui;
21 import java.awt.event.*;
30 public class GSliderPanel extends JPanel
32 // this is used for conservation colours, PID colours and redundancy threshold
33 protected JSlider slider = new JSlider();
35 protected JTextField valueField = new JTextField();
37 protected JLabel label = new JLabel();
39 protected JPanel southPanel = new JPanel();
41 GridLayout gridLayout1 = new GridLayout();
43 JPanel jPanel2 = new JPanel();
45 protected JButton applyButton = new JButton();
47 protected JButton undoButton = new JButton();
49 FlowLayout flowLayout1 = new FlowLayout();
51 protected JCheckBox allGroupsCheck = new JCheckBox();
53 BorderLayout borderLayout1 = new BorderLayout();
55 JPanel jPanel1 = new JPanel();
57 BorderLayout borderLayout2 = new BorderLayout();
60 * Creates a new GSliderPanel object.
79 private void jbInit() throws Exception
81 this.setLayout(gridLayout1);
82 slider.setMajorTickSpacing(10);
83 slider.setMinorTickSpacing(1);
84 slider.setPaintTicks(true);
85 slider.setBackground(Color.white);
86 slider.setFont(new java.awt.Font("Verdana", 0, 11));
87 slider.setDoubleBuffered(true);
88 slider.addMouseListener(new MouseAdapter()
90 public void mouseReleased(MouseEvent e)
92 slider_mouseReleased(e);
95 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
96 valueField.setMinimumSize(new Dimension(6, 14));
97 valueField.setPreferredSize(new Dimension(50, 12));
98 valueField.setText("");
99 valueField.setHorizontalAlignment(SwingConstants.CENTER);
100 valueField.addActionListener(new java.awt.event.ActionListener()
102 public void actionPerformed(ActionEvent e)
104 valueField_actionPerformed(e);
107 label.setFont(new java.awt.Font("Verdana", 0, 11));
108 label.setOpaque(false);
109 label.setHorizontalAlignment(SwingConstants.CENTER);
110 label.setText("set this label text");
111 southPanel.setLayout(borderLayout1);
112 gridLayout1.setRows(2);
113 jPanel2.setLayout(flowLayout1);
114 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
115 applyButton.setOpaque(false);
116 applyButton.setText("Apply");
117 applyButton.addActionListener(new java.awt.event.ActionListener()
119 public void actionPerformed(ActionEvent e)
121 applyButton_actionPerformed(e);
124 undoButton.setEnabled(false);
125 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
126 undoButton.setOpaque(false);
127 undoButton.setText("Undo");
128 undoButton.addActionListener(new java.awt.event.ActionListener()
130 public void actionPerformed(ActionEvent e)
132 undoButton_actionPerformed(e);
135 allGroupsCheck.setEnabled(false);
136 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
137 allGroupsCheck.setOpaque(false);
138 allGroupsCheck.setText("Apply to all Groups");
139 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
141 public void actionPerformed(ActionEvent e)
143 allGroupsCheck_actionPerformed(e);
146 this.setBackground(Color.white);
147 this.setPreferredSize(new Dimension(415, 84));
148 jPanel2.setOpaque(false);
149 southPanel.setOpaque(false);
150 jPanel1.setLayout(borderLayout2);
151 jPanel1.setOpaque(false);
152 this.add(jPanel2, null);
153 jPanel2.add(label, null);
154 jPanel2.add(applyButton, null);
155 jPanel2.add(undoButton, null);
156 this.add(southPanel, null);
157 southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
158 southPanel.add(slider, java.awt.BorderLayout.CENTER);
159 jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
160 jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
169 protected void valueField_actionPerformed(ActionEvent e)
179 protected void applyButton_actionPerformed(ActionEvent e)
189 protected void undoButton_actionPerformed(ActionEvent e)
199 protected void allGroupsCheck_actionPerformed(ActionEvent e)
203 public void slider_mouseReleased(MouseEvent e)