2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.util.MessageManager;
26 import java.awt.event.*;
35 public class GSliderPanel extends JPanel
37 // this is used for conservation colours, PID colours and redundancy threshold
38 protected JSlider slider = new JSlider();
40 protected JTextField valueField = new JTextField();
42 protected JLabel label = new JLabel();
44 protected JPanel southPanel = new JPanel();
46 GridLayout gridLayout1 = new GridLayout();
48 JPanel jPanel2 = new JPanel();
50 protected JButton applyButton = new JButton();
52 protected JButton undoButton = new JButton();
54 FlowLayout flowLayout1 = new FlowLayout();
56 protected JCheckBox allGroupsCheck = new JCheckBox();
58 BorderLayout borderLayout1 = new BorderLayout();
60 JPanel jPanel1 = new JPanel();
62 BorderLayout borderLayout2 = new BorderLayout();
65 * Creates a new GSliderPanel object.
84 private void jbInit() throws Exception
86 this.setLayout(gridLayout1);
87 slider.setMajorTickSpacing(10);
88 slider.setMinorTickSpacing(1);
89 slider.setPaintTicks(true);
90 slider.setBackground(Color.white);
91 slider.setFont(new java.awt.Font("Verdana", 0, 11));
92 slider.setDoubleBuffered(true);
93 slider.addMouseListener(new MouseAdapter()
95 public void mouseReleased(MouseEvent e)
97 slider_mouseReleased(e);
100 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
101 valueField.setMinimumSize(new Dimension(6, 14));
102 valueField.setPreferredSize(new Dimension(50, 12));
103 valueField.setText("");
104 valueField.setHorizontalAlignment(SwingConstants.CENTER);
105 valueField.addActionListener(new java.awt.event.ActionListener()
107 public void actionPerformed(ActionEvent e)
109 valueField_actionPerformed(e);
112 label.setFont(new java.awt.Font("Verdana", 0, 11));
113 label.setOpaque(false);
114 label.setHorizontalAlignment(SwingConstants.CENTER);
115 label.setText(MessageManager.getString("label.set_this_label_text"));
116 southPanel.setLayout(borderLayout1);
117 gridLayout1.setRows(2);
118 jPanel2.setLayout(flowLayout1);
119 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
120 applyButton.setOpaque(false);
121 applyButton.setText(MessageManager.getString("action.apply"));
122 applyButton.addActionListener(new java.awt.event.ActionListener()
124 public void actionPerformed(ActionEvent e)
126 applyButton_actionPerformed(e);
129 undoButton.setEnabled(false);
130 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
131 undoButton.setOpaque(false);
132 undoButton.setText(MessageManager.getString("action.undo"));
133 undoButton.addActionListener(new java.awt.event.ActionListener()
135 public void actionPerformed(ActionEvent e)
137 undoButton_actionPerformed(e);
140 allGroupsCheck.setEnabled(false);
141 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
142 allGroupsCheck.setOpaque(false);
143 allGroupsCheck.setText(MessageManager
144 .getString("action.apply_all_groups"));
145 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
147 public void actionPerformed(ActionEvent e)
149 allGroupsCheck_actionPerformed(e);
152 this.setBackground(Color.white);
153 this.setPreferredSize(new Dimension(415, 84));
154 jPanel2.setOpaque(false);
155 southPanel.setOpaque(false);
156 jPanel1.setLayout(borderLayout2);
157 jPanel1.setOpaque(false);
158 this.add(jPanel2, null);
159 jPanel2.add(label, null);
160 jPanel2.add(applyButton, null);
161 jPanel2.add(undoButton, null);
162 this.add(southPanel, null);
163 southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
164 southPanel.add(slider, java.awt.BorderLayout.CENTER);
165 jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
166 jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
175 protected void valueField_actionPerformed(ActionEvent e)
185 protected void applyButton_actionPerformed(ActionEvent e)
195 protected void undoButton_actionPerformed(ActionEvent e)
205 protected void allGroupsCheck_actionPerformed(ActionEvent e)
209 public void slider_mouseReleased(MouseEvent e)