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.FlowLayout;
29 import java.awt.GridLayout;
30 import java.awt.event.ActionEvent;
31 import java.awt.event.ActionListener;
33 import javax.swing.JButton;
34 import javax.swing.JCheckBoxMenuItem;
35 import javax.swing.JComboBox;
36 import javax.swing.JInternalFrame;
37 import javax.swing.JLabel;
38 import javax.swing.JMenu;
39 import javax.swing.JMenuBar;
40 import javax.swing.JMenuItem;
41 import javax.swing.JPanel;
42 import javax.swing.event.MenuEvent;
43 import javax.swing.event.MenuListener;
45 public class GPCAPanel extends JInternalFrame
47 private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
49 protected JComboBox<String> xCombobox = new JComboBox<>();
51 protected JComboBox<String> yCombobox = new JComboBox<>();
53 protected JComboBox<String> zCombobox = new JComboBox<>();
55 protected JMenu viewMenu = new JMenu();
57 protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
59 protected JMenu associateViewsMenu = new JMenu();
61 protected JLabel statusBar = new JLabel();
63 protected JPanel statusPanel = new JPanel();
65 protected JMenuItem originalSeqData;
80 for (int i = 1; i < 8; i++)
82 xCombobox.addItem("dim " + i);
83 yCombobox.addItem("dim " + i);
84 zCombobox.addItem("dim " + i);
88 private void jbInit() throws Exception
90 this.getContentPane().setLayout(new BorderLayout());
91 JPanel jPanel2 = new JPanel();
92 jPanel2.setLayout(new FlowLayout());
93 JLabel jLabel1 = new JLabel();
94 jLabel1.setFont(VERDANA_12);
95 jLabel1.setText("x=");
96 JLabel jLabel2 = new JLabel();
97 jLabel2.setFont(VERDANA_12);
98 jLabel2.setText("y=");
99 JLabel jLabel3 = new JLabel();
100 jLabel3.setFont(VERDANA_12);
101 jLabel3.setText("z=");
102 jPanel2.setBackground(Color.white);
103 jPanel2.setBorder(null);
104 zCombobox.setFont(VERDANA_12);
105 zCombobox.addActionListener(new ActionListener()
108 public void actionPerformed(ActionEvent e)
113 yCombobox.setFont(VERDANA_12);
114 yCombobox.addActionListener(new ActionListener()
117 public void actionPerformed(ActionEvent e)
122 xCombobox.setFont(VERDANA_12);
123 xCombobox.addActionListener(new ActionListener()
126 public void actionPerformed(ActionEvent e)
131 JButton resetButton = new JButton();
132 resetButton.setFont(VERDANA_12);
133 resetButton.setText(MessageManager.getString("action.reset"));
134 resetButton.addActionListener(new ActionListener()
137 public void actionPerformed(ActionEvent e)
139 resetButton_actionPerformed();
142 JMenu fileMenu = new JMenu();
143 fileMenu.setText(MessageManager.getString("action.file"));
144 JMenu saveMenu = new JMenu();
145 saveMenu.setText(MessageManager.getString("action.save_as"));
146 JMenuItem eps = new JMenuItem("EPS");
147 eps.addActionListener(new ActionListener()
150 public void actionPerformed(ActionEvent e)
152 eps_actionPerformed();
155 JMenuItem png = new JMenuItem("PNG");
156 png.addActionListener(new ActionListener()
159 public void actionPerformed(ActionEvent e)
161 png_actionPerformed();
164 JMenuItem outputValues = new JMenuItem();
165 outputValues.setText(MessageManager.getString("label.output_values"));
166 outputValues.addActionListener(new ActionListener()
169 public void actionPerformed(ActionEvent e)
171 outputValues_actionPerformed();
174 JMenuItem outputPoints = new JMenuItem();
175 outputPoints.setText(MessageManager.getString("label.output_points"));
176 outputPoints.addActionListener(new ActionListener()
179 public void actionPerformed(ActionEvent e)
181 outputPoints_actionPerformed();
184 JMenuItem outputProjPoints = new JMenuItem();
185 outputProjPoints.setText(
186 MessageManager.getString("label.output_transformed_points"));
187 outputProjPoints.addActionListener(new ActionListener()
190 public void actionPerformed(ActionEvent e)
192 outputProjPoints_actionPerformed();
195 JMenuItem print = new JMenuItem();
196 print.setText(MessageManager.getString("action.print"));
197 print.addActionListener(new ActionListener()
200 public void actionPerformed(ActionEvent e)
202 print_actionPerformed();
205 viewMenu.setText(MessageManager.getString("action.view"));
206 viewMenu.addMenuListener(new MenuListener()
209 public void menuSelected(MenuEvent e)
211 viewMenu_menuSelected();
215 public void menuDeselected(MenuEvent e)
220 public void menuCanceled(MenuEvent e)
224 showLabels.setText(MessageManager.getString("label.show_labels"));
225 showLabels.addActionListener(new ActionListener()
228 public void actionPerformed(ActionEvent e)
230 showLabels_actionPerformed();
233 JMenuItem bgcolour = new JMenuItem();
234 bgcolour.setText(MessageManager.getString("action.background_colour"));
235 bgcolour.addActionListener(new ActionListener()
238 public void actionPerformed(ActionEvent e)
240 bgcolour_actionPerformed();
243 originalSeqData = new JMenuItem();
244 originalSeqData.setText(MessageManager.getString("label.input_data"));
245 originalSeqData.addActionListener(new ActionListener()
248 public void actionPerformed(ActionEvent e)
250 originalSeqData_actionPerformed();
253 associateViewsMenu.setText(
254 MessageManager.getString("label.associate_nodes_with"));
256 statusPanel.setLayout(new GridLayout());
257 statusBar.setFont(VERDANA_12);
258 // statusPanel.setBackground(Color.lightGray);
259 // statusBar.setBackground(Color.lightGray);
260 // statusPanel.add(statusBar, null);
261 JPanel panelBar = new JPanel(new BorderLayout());
262 panelBar.add(jPanel2, BorderLayout.NORTH);
263 panelBar.add(statusPanel, BorderLayout.SOUTH);
264 this.getContentPane().add(panelBar, BorderLayout.SOUTH);
265 jPanel2.add(jLabel1, null);
266 jPanel2.add(xCombobox, null);
267 jPanel2.add(jLabel2, null);
268 jPanel2.add(yCombobox, null);
269 jPanel2.add(jLabel3, null);
270 jPanel2.add(zCombobox, null);
271 jPanel2.add(resetButton, null);
273 JMenuBar jMenuBar1 = new JMenuBar();
274 jMenuBar1.add(fileMenu);
275 jMenuBar1.add(viewMenu);
276 setJMenuBar(jMenuBar1);
277 fileMenu.add(saveMenu);
278 fileMenu.add(outputValues);
280 fileMenu.add(originalSeqData);
281 fileMenu.add(outputPoints);
282 fileMenu.add(outputProjPoints);
285 viewMenu.add(showLabels);
286 viewMenu.add(bgcolour);
287 viewMenu.add(associateViewsMenu);
290 protected void resetButton_actionPerformed()
294 protected void outputPoints_actionPerformed()
298 protected void outputProjPoints_actionPerformed()
302 protected void eps_actionPerformed()
306 protected void png_actionPerformed()
310 protected void outputValues_actionPerformed()
314 protected void print_actionPerformed()
318 protected void showLabels_actionPerformed()
322 protected void bgcolour_actionPerformed()
326 protected void originalSeqData_actionPerformed()
330 protected void viewMenu_menuSelected()
334 protected void doDimensionChange()