2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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 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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.jbgui;
21 import jalview.util.MessageManager;
24 import java.awt.event.*;
33 public class GSliderPanel extends JPanel
35 // this is used for conservation colours, PID colours and redundancy threshold
36 protected JSlider slider = new JSlider();
38 protected JTextField valueField = new JTextField();
40 protected JLabel label = new JLabel();
42 protected JPanel southPanel = new JPanel();
44 GridLayout gridLayout1 = new GridLayout();
46 JPanel jPanel2 = new JPanel();
48 protected JButton applyButton = new JButton();
50 protected JButton undoButton = new JButton();
52 FlowLayout flowLayout1 = new FlowLayout();
54 protected JCheckBox allGroupsCheck = new JCheckBox();
56 BorderLayout borderLayout1 = new BorderLayout();
58 JPanel jPanel1 = new JPanel();
60 BorderLayout borderLayout2 = new BorderLayout();
63 * Creates a new GSliderPanel object.
82 private void jbInit() throws Exception
84 this.setLayout(gridLayout1);
85 slider.setMajorTickSpacing(10);
86 slider.setMinorTickSpacing(1);
87 slider.setPaintTicks(true);
88 slider.setBackground(Color.white);
89 slider.setFont(new java.awt.Font("Verdana", 0, 11));
90 slider.setDoubleBuffered(true);
91 slider.addMouseListener(new MouseAdapter()
93 public void mouseReleased(MouseEvent e)
95 slider_mouseReleased(e);
98 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
99 valueField.setMinimumSize(new Dimension(6, 14));
100 valueField.setPreferredSize(new Dimension(50, 12));
101 valueField.setText("");
102 valueField.setHorizontalAlignment(SwingConstants.CENTER);
103 valueField.addActionListener(new java.awt.event.ActionListener()
105 public void actionPerformed(ActionEvent e)
107 valueField_actionPerformed(e);
110 label.setFont(new java.awt.Font("Verdana", 0, 11));
111 label.setOpaque(false);
112 label.setHorizontalAlignment(SwingConstants.CENTER);
113 label.setText(MessageManager.getString("label.set_this_label_text"));
114 southPanel.setLayout(borderLayout1);
115 gridLayout1.setRows(2);
116 jPanel2.setLayout(flowLayout1);
117 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
118 applyButton.setOpaque(false);
119 applyButton.setText(MessageManager.getString("action.apply"));
120 applyButton.addActionListener(new java.awt.event.ActionListener()
122 public void actionPerformed(ActionEvent e)
124 applyButton_actionPerformed(e);
127 undoButton.setEnabled(false);
128 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
129 undoButton.setOpaque(false);
130 undoButton.setText(MessageManager.getString("action.undo"));
131 undoButton.addActionListener(new java.awt.event.ActionListener()
133 public void actionPerformed(ActionEvent e)
135 undoButton_actionPerformed(e);
138 allGroupsCheck.setEnabled(false);
139 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
140 allGroupsCheck.setOpaque(false);
141 allGroupsCheck.setText(MessageManager.getString("action.apply_all_groups"));
142 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
144 public void actionPerformed(ActionEvent e)
146 allGroupsCheck_actionPerformed(e);
149 this.setBackground(Color.white);
150 this.setPreferredSize(new Dimension(415, 84));
151 jPanel2.setOpaque(false);
152 southPanel.setOpaque(false);
153 jPanel1.setLayout(borderLayout2);
154 jPanel1.setOpaque(false);
155 this.add(jPanel2, null);
156 jPanel2.add(label, null);
157 jPanel2.add(applyButton, null);
158 jPanel2.add(undoButton, null);
159 this.add(southPanel, null);
160 southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
161 southPanel.add(slider, java.awt.BorderLayout.CENTER);
162 jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
163 jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
172 protected void valueField_actionPerformed(ActionEvent e)
182 protected void applyButton_actionPerformed(ActionEvent e)
192 protected void undoButton_actionPerformed(ActionEvent e)
202 protected void allGroupsCheck_actionPerformed(ActionEvent e)
206 public void slider_mouseReleased(MouseEvent e)