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.ImageMaker.TYPE;
24 import jalview.util.MessageManager;
26 import java.awt.BorderLayout;
27 import java.awt.Color;
28 import java.awt.FlowLayout;
30 import java.awt.GridLayout;
31 import java.awt.event.ActionEvent;
32 import java.awt.event.ActionListener;
34 import javax.swing.JButton;
35 import javax.swing.JCheckBoxMenuItem;
36 import javax.swing.JComboBox;
37 import javax.swing.JInternalFrame;
38 import javax.swing.JLabel;
39 import javax.swing.JMenu;
40 import javax.swing.JMenuBar;
41 import javax.swing.JMenuItem;
42 import javax.swing.JPanel;
43 import javax.swing.event.MenuEvent;
44 import javax.swing.event.MenuListener;
46 public class GPCAPanel extends JInternalFrame
48 private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
50 protected JComboBox<String> xCombobox = new JComboBox<>();
52 protected JComboBox<String> yCombobox = new JComboBox<>();
54 protected JComboBox<String> zCombobox = new JComboBox<>();
56 protected JMenu viewMenu = new JMenu();
58 protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
60 protected JMenu associateViewsMenu = new JMenu();
62 protected JLabel statusBar = new JLabel();
64 protected JPanel statusPanel = new JPanel();
66 protected JMenuItem originalSeqData;
81 for (int i = 1; i < 8; i++)
83 xCombobox.addItem("dim " + i);
84 yCombobox.addItem("dim " + i);
85 zCombobox.addItem("dim " + i);
89 private void jbInit() throws Exception
91 this.getContentPane().setLayout(new BorderLayout());
92 JPanel jPanel2 = new JPanel();
93 jPanel2.setLayout(new FlowLayout());
94 JLabel jLabel1 = new JLabel();
95 jLabel1.setFont(VERDANA_12);
96 jLabel1.setText("x=");
97 JLabel jLabel2 = new JLabel();
98 jLabel2.setFont(VERDANA_12);
99 jLabel2.setText("y=");
100 JLabel jLabel3 = new JLabel();
101 jLabel3.setFont(VERDANA_12);
102 jLabel3.setText("z=");
103 jPanel2.setBackground(Color.white);
104 jPanel2.setBorder(null);
105 zCombobox.setFont(VERDANA_12);
106 zCombobox.addActionListener(new ActionListener()
109 public void actionPerformed(ActionEvent e)
114 yCombobox.setFont(VERDANA_12);
115 yCombobox.addActionListener(new ActionListener()
118 public void actionPerformed(ActionEvent e)
123 xCombobox.setFont(VERDANA_12);
124 xCombobox.addActionListener(new ActionListener()
127 public void actionPerformed(ActionEvent e)
132 JButton resetButton = new JButton();
133 resetButton.setFont(VERDANA_12);
134 resetButton.setText(MessageManager.getString("action.reset"));
135 resetButton.addActionListener(new ActionListener()
138 public void actionPerformed(ActionEvent e)
140 resetButton_actionPerformed();
143 JMenu fileMenu = new JMenu();
144 fileMenu.setText(MessageManager.getString("action.file"));
145 JMenu saveMenu = new JMenu();
146 saveMenu.setText(MessageManager.getString("action.save_as"));
147 JMenuItem eps = new JMenuItem("EPS");
148 eps.addActionListener(new ActionListener()
151 public void actionPerformed(ActionEvent e)
153 makePCAImage(TYPE.EPS);
156 JMenuItem png = new JMenuItem("PNG");
157 png.addActionListener(new ActionListener()
160 public void actionPerformed(ActionEvent e)
162 makePCAImage(TYPE.PNG);
165 JMenuItem outputValues = new JMenuItem();
166 outputValues.setText(MessageManager.getString("label.output_values"));
167 outputValues.addActionListener(new ActionListener()
170 public void actionPerformed(ActionEvent e)
172 outputValues_actionPerformed();
175 JMenuItem outputPoints = new JMenuItem();
176 outputPoints.setText(MessageManager.getString("label.output_points"));
177 outputPoints.addActionListener(new ActionListener()
180 public void actionPerformed(ActionEvent e)
182 outputPoints_actionPerformed();
185 JMenuItem outputProjPoints = new JMenuItem();
186 outputProjPoints.setText(
187 MessageManager.getString("label.output_transformed_points"));
188 outputProjPoints.addActionListener(new ActionListener()
191 public void actionPerformed(ActionEvent e)
193 outputProjPoints_actionPerformed();
196 JMenuItem print = new JMenuItem();
197 print.setText(MessageManager.getString("action.print"));
198 print.addActionListener(new ActionListener()
201 public void actionPerformed(ActionEvent e)
203 print_actionPerformed();
206 viewMenu.setText(MessageManager.getString("action.view"));
207 viewMenu.addMenuListener(new MenuListener()
210 public void menuSelected(MenuEvent e)
212 viewMenu_menuSelected();
216 public void menuDeselected(MenuEvent e)
221 public void menuCanceled(MenuEvent e)
225 showLabels.setText(MessageManager.getString("label.show_labels"));
226 showLabels.addActionListener(new ActionListener()
229 public void actionPerformed(ActionEvent e)
231 showLabels_actionPerformed();
234 JMenuItem bgcolour = new JMenuItem();
235 bgcolour.setText(MessageManager.getString("action.background_colour"));
236 bgcolour.addActionListener(new ActionListener()
239 public void actionPerformed(ActionEvent e)
241 bgcolour_actionPerformed();
244 originalSeqData = new JMenuItem();
245 originalSeqData.setText(MessageManager.getString("label.input_data"));
246 originalSeqData.addActionListener(new ActionListener()
249 public void actionPerformed(ActionEvent e)
251 originalSeqData_actionPerformed();
254 associateViewsMenu.setText(
255 MessageManager.getString("label.associate_nodes_with"));
257 statusPanel.setLayout(new GridLayout());
258 statusBar.setFont(VERDANA_12);
259 // statusPanel.setBackground(Color.lightGray);
260 // statusBar.setBackground(Color.lightGray);
261 // statusPanel.add(statusBar, null);
262 JPanel panelBar = new JPanel(new BorderLayout());
263 panelBar.add(jPanel2, BorderLayout.NORTH);
264 panelBar.add(statusPanel, BorderLayout.SOUTH);
265 this.getContentPane().add(panelBar, BorderLayout.SOUTH);
266 jPanel2.add(jLabel1, null);
267 jPanel2.add(xCombobox, null);
268 jPanel2.add(jLabel2, null);
269 jPanel2.add(yCombobox, null);
270 jPanel2.add(jLabel3, null);
271 jPanel2.add(zCombobox, null);
272 jPanel2.add(resetButton, null);
274 JMenuBar jMenuBar1 = new JMenuBar();
275 jMenuBar1.add(fileMenu);
276 jMenuBar1.add(viewMenu);
277 setJMenuBar(jMenuBar1);
278 fileMenu.add(saveMenu);
279 fileMenu.add(outputValues);
281 fileMenu.add(originalSeqData);
282 fileMenu.add(outputPoints);
283 fileMenu.add(outputProjPoints);
286 viewMenu.add(showLabels);
287 viewMenu.add(bgcolour);
288 viewMenu.add(associateViewsMenu);
291 protected void resetButton_actionPerformed()
295 protected void outputPoints_actionPerformed()
299 protected void outputProjPoints_actionPerformed()
303 public void makePCAImage(TYPE imageType)
307 protected void outputValues_actionPerformed()
311 protected void print_actionPerformed()
315 protected void showLabels_actionPerformed()
319 protected void bgcolour_actionPerformed()
323 protected void originalSeqData_actionPerformed()
327 protected void viewMenu_menuSelected()
331 protected void doDimensionChange()