2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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;
20 import jalview.util.MessageManager;
23 import java.awt.event.*;
32 public class GSliderPanel extends JPanel
34 // this is used for conservation colours, PID colours and redundancy threshold
35 protected JSlider slider = new JSlider();
37 protected JTextField valueField = new JTextField();
39 protected JLabel label = new JLabel();
41 protected JPanel southPanel = new JPanel();
43 GridLayout gridLayout1 = new GridLayout();
45 JPanel jPanel2 = new JPanel();
47 protected JButton applyButton = new JButton();
49 protected JButton undoButton = new JButton();
51 FlowLayout flowLayout1 = new FlowLayout();
53 protected JCheckBox allGroupsCheck = new JCheckBox();
55 BorderLayout borderLayout1 = new BorderLayout();
57 JPanel jPanel1 = new JPanel();
59 BorderLayout borderLayout2 = new BorderLayout();
62 * Creates a new GSliderPanel object.
81 private void jbInit() throws Exception
83 this.setLayout(gridLayout1);
84 slider.setMajorTickSpacing(10);
85 slider.setMinorTickSpacing(1);
86 slider.setPaintTicks(true);
87 slider.setBackground(Color.white);
88 slider.setFont(new java.awt.Font("Verdana", 0, 11));
89 slider.setDoubleBuffered(true);
90 slider.addMouseListener(new MouseAdapter()
92 public void mouseReleased(MouseEvent e)
94 slider_mouseReleased(e);
97 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
98 valueField.setMinimumSize(new Dimension(6, 14));
99 valueField.setPreferredSize(new Dimension(50, 12));
100 valueField.setText("");
101 valueField.setHorizontalAlignment(SwingConstants.CENTER);
102 valueField.addActionListener(new java.awt.event.ActionListener()
104 public void actionPerformed(ActionEvent e)
106 valueField_actionPerformed(e);
109 label.setFont(new java.awt.Font("Verdana", 0, 11));
110 label.setOpaque(false);
111 label.setHorizontalAlignment(SwingConstants.CENTER);
112 label.setText(MessageManager.getString("label.set_this_label_text"));
113 southPanel.setLayout(borderLayout1);
114 gridLayout1.setRows(2);
115 jPanel2.setLayout(flowLayout1);
116 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
117 applyButton.setOpaque(false);
118 applyButton.setText(MessageManager.getString("action.apply"));
119 applyButton.addActionListener(new java.awt.event.ActionListener()
121 public void actionPerformed(ActionEvent e)
123 applyButton_actionPerformed(e);
126 undoButton.setEnabled(false);
127 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
128 undoButton.setOpaque(false);
129 undoButton.setText(MessageManager.getString("action.undo"));
130 undoButton.addActionListener(new java.awt.event.ActionListener()
132 public void actionPerformed(ActionEvent e)
134 undoButton_actionPerformed(e);
137 allGroupsCheck.setEnabled(false);
138 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
139 allGroupsCheck.setOpaque(false);
140 allGroupsCheck.setText(MessageManager.getString("action.apply_all_groups"));
141 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
143 public void actionPerformed(ActionEvent e)
145 allGroupsCheck_actionPerformed(e);
148 this.setBackground(Color.white);
149 this.setPreferredSize(new Dimension(415, 84));
150 jPanel2.setOpaque(false);
151 southPanel.setOpaque(false);
152 jPanel1.setLayout(borderLayout2);
153 jPanel1.setOpaque(false);
154 this.add(jPanel2, null);
155 jPanel2.add(label, null);
156 jPanel2.add(applyButton, null);
157 jPanel2.add(undoButton, null);
158 this.add(southPanel, null);
159 southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
160 southPanel.add(slider, java.awt.BorderLayout.CENTER);
161 jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
162 jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
171 protected void valueField_actionPerformed(ActionEvent e)
181 protected void applyButton_actionPerformed(ActionEvent e)
191 protected void undoButton_actionPerformed(ActionEvent e)
201 protected void allGroupsCheck_actionPerformed(ActionEvent e)
205 public void slider_mouseReleased(MouseEvent e)