2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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;
25 import java.awt.BorderLayout;
26 import java.awt.Color;
27 import java.awt.Dimension;
28 import java.awt.FlowLayout;
29 import java.awt.GridLayout;
30 import java.awt.event.ActionEvent;
31 import java.awt.event.MouseAdapter;
32 import java.awt.event.MouseEvent;
34 import javax.swing.JButton;
35 import javax.swing.JCheckBox;
36 import javax.swing.JLabel;
37 import javax.swing.JPanel;
38 import javax.swing.JSlider;
39 import javax.swing.JTextField;
40 import javax.swing.SwingConstants;
48 public class GSliderPanel extends JPanel
50 // this is used for conservation colours, PID colours and redundancy threshold
51 protected JSlider slider = new JSlider();
53 protected JTextField valueField = new JTextField();
55 protected JLabel label = new JLabel();
57 protected JPanel southPanel = new JPanel();
59 GridLayout gridLayout1 = new GridLayout();
61 JPanel jPanel2 = new JPanel();
63 protected JButton applyButton = new JButton();
65 protected JButton undoButton = new JButton();
67 FlowLayout flowLayout1 = new FlowLayout();
69 protected JCheckBox allGroupsCheck = new JCheckBox();
71 BorderLayout borderLayout1 = new BorderLayout();
73 JPanel jPanel1 = new JPanel();
75 BorderLayout borderLayout2 = new BorderLayout();
78 * Creates a new GSliderPanel object.
97 private void jbInit() throws Exception
99 this.setLayout(gridLayout1);
100 slider.setMajorTickSpacing(10);
101 slider.setMinorTickSpacing(1);
102 slider.setPaintTicks(true);
103 slider.setBackground(Color.white);
104 slider.setFont(new java.awt.Font("Verdana", 0, 11));
105 slider.setDoubleBuffered(true);
106 slider.addMouseListener(new MouseAdapter()
108 public void mouseReleased(MouseEvent e)
110 slider_mouseReleased(e);
113 valueField.setFont(new java.awt.Font("Verdana", 0, 11));
114 valueField.setMinimumSize(new Dimension(6, 14));
115 valueField.setPreferredSize(new Dimension(50, 12));
116 valueField.setText("");
117 valueField.setHorizontalAlignment(SwingConstants.CENTER);
118 valueField.addActionListener(new java.awt.event.ActionListener()
120 public void actionPerformed(ActionEvent e)
122 valueField_actionPerformed(e);
125 label.setFont(new java.awt.Font("Verdana", 0, 11));
126 label.setOpaque(false);
127 label.setHorizontalAlignment(SwingConstants.CENTER);
128 label.setText(MessageManager.getString("label.set_this_label_text"));
129 southPanel.setLayout(borderLayout1);
130 gridLayout1.setRows(2);
131 jPanel2.setLayout(flowLayout1);
132 applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
133 applyButton.setOpaque(false);
134 applyButton.setText(MessageManager.getString("action.apply"));
135 applyButton.addActionListener(new java.awt.event.ActionListener()
137 public void actionPerformed(ActionEvent e)
139 applyButton_actionPerformed(e);
142 undoButton.setEnabled(false);
143 undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
144 undoButton.setOpaque(false);
145 undoButton.setText(MessageManager.getString("action.undo"));
146 undoButton.addActionListener(new java.awt.event.ActionListener()
148 public void actionPerformed(ActionEvent e)
150 undoButton_actionPerformed(e);
153 allGroupsCheck.setEnabled(false);
154 allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
155 allGroupsCheck.setOpaque(false);
156 allGroupsCheck.setText(MessageManager
157 .getString("action.apply_all_groups"));
158 allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
160 public void actionPerformed(ActionEvent e)
162 allGroupsCheck_actionPerformed(e);
165 this.setBackground(Color.white);
166 this.setPreferredSize(new Dimension(415, 84));
167 jPanel2.setOpaque(false);
168 southPanel.setOpaque(false);
169 jPanel1.setLayout(borderLayout2);
170 jPanel1.setOpaque(false);
171 this.add(jPanel2, null);
172 jPanel2.add(label, null);
173 jPanel2.add(applyButton, null);
174 jPanel2.add(undoButton, null);
175 this.add(southPanel, null);
176 southPanel.add(jPanel1, java.awt.BorderLayout.EAST);
177 southPanel.add(slider, java.awt.BorderLayout.CENTER);
178 jPanel1.add(valueField, java.awt.BorderLayout.CENTER);
179 jPanel1.add(allGroupsCheck, java.awt.BorderLayout.EAST);
188 protected void valueField_actionPerformed(ActionEvent e)
198 protected void applyButton_actionPerformed(ActionEvent e)
208 protected void undoButton_actionPerformed(ActionEvent e)
218 protected void allGroupsCheck_actionPerformed(ActionEvent e)
222 public void slider_mouseReleased(MouseEvent e)