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<String>();
51 protected JComboBox<String> yCombobox = new JComboBox<String>();
53 protected JComboBox<String> zCombobox = new JComboBox<String>();
55 protected JMenu scoreModelMenu = new JMenu();
57 protected JMenu viewMenu = new JMenu();
59 protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
61 protected JMenu associateViewsMenu = new JMenu();
63 protected JMenu calcSettings = new JMenu();
65 protected JCheckBoxMenuItem nuclSetting = new JCheckBoxMenuItem();
67 protected JCheckBoxMenuItem protSetting = new JCheckBoxMenuItem();
69 protected JLabel statusBar = new JLabel();
71 protected JPanel statusPanel = new JPanel();
83 for (int i = 1; i < 8; i++)
85 xCombobox.addItem("dim " + i);
86 yCombobox.addItem("dim " + i);
87 zCombobox.addItem("dim " + i);
91 private void jbInit() throws Exception
93 this.getContentPane().setLayout(new BorderLayout());
94 JPanel jPanel2 = new JPanel();
95 jPanel2.setLayout(new FlowLayout());
96 JLabel jLabel1 = new JLabel();
97 jLabel1.setFont(VERDANA_12);
98 jLabel1.setText("x=");
99 JLabel jLabel2 = new JLabel();
100 jLabel2.setFont(VERDANA_12);
101 jLabel2.setText("y=");
102 JLabel jLabel3 = new JLabel();
103 jLabel3.setFont(VERDANA_12);
104 jLabel3.setText("z=");
105 jPanel2.setBackground(Color.white);
106 jPanel2.setBorder(null);
107 zCombobox.setFont(VERDANA_12);
108 zCombobox.addActionListener(new ActionListener()
111 public void actionPerformed(ActionEvent e)
113 zCombobox_actionPerformed(e);
116 yCombobox.setFont(VERDANA_12);
117 yCombobox.addActionListener(new ActionListener()
120 public void actionPerformed(ActionEvent e)
122 yCombobox_actionPerformed(e);
125 xCombobox.setFont(VERDANA_12);
126 xCombobox.addActionListener(new ActionListener()
129 public void actionPerformed(ActionEvent e)
131 xCombobox_actionPerformed(e);
134 JButton resetButton = new JButton();
135 resetButton.setFont(VERDANA_12);
136 resetButton.setText(MessageManager.getString("action.reset"));
137 resetButton.addActionListener(new ActionListener()
140 public void actionPerformed(ActionEvent e)
142 resetButton_actionPerformed(e);
145 JMenu fileMenu = new JMenu();
146 fileMenu.setText(MessageManager.getString("action.file"));
147 JMenu saveMenu = new JMenu();
148 saveMenu.setText(MessageManager.getString("action.save_as"));
149 JMenuItem eps = new JMenuItem("EPS");
150 eps.addActionListener(new ActionListener()
153 public void actionPerformed(ActionEvent e)
155 eps_actionPerformed(e);
158 JMenuItem png = new JMenuItem("PNG");
159 png.addActionListener(new ActionListener()
162 public void actionPerformed(ActionEvent e)
164 png_actionPerformed(e);
167 JMenuItem outputValues = new JMenuItem();
168 outputValues.setText(MessageManager.getString("label.output_values"));
169 outputValues.addActionListener(new ActionListener()
172 public void actionPerformed(ActionEvent e)
174 outputValues_actionPerformed(e);
177 JMenuItem outputPoints = new JMenuItem();
178 outputPoints.setText(MessageManager.getString("label.output_points"));
179 outputPoints.addActionListener(new ActionListener()
182 public void actionPerformed(ActionEvent e)
184 outputPoints_actionPerformed(e);
187 JMenuItem outputProjPoints = new JMenuItem();
188 outputProjPoints.setText(
189 MessageManager.getString("label.output_transformed_points"));
190 outputProjPoints.addActionListener(new ActionListener()
193 public void actionPerformed(ActionEvent e)
195 outputProjPoints_actionPerformed(e);
198 JMenuItem print = new JMenuItem();
199 print.setText(MessageManager.getString("action.print"));
200 print.addActionListener(new ActionListener()
203 public void actionPerformed(ActionEvent e)
205 print_actionPerformed(e);
208 viewMenu.setText(MessageManager.getString("action.view"));
209 viewMenu.addMenuListener(new MenuListener()
212 public void menuSelected(MenuEvent e)
214 viewMenu_menuSelected();
218 public void menuDeselected(MenuEvent e)
223 public void menuCanceled(MenuEvent e)
228 .setText(MessageManager.getString("label.select_score_model"));
229 scoreModelMenu.addMenuListener(new MenuListener()
232 public void menuSelected(MenuEvent e)
234 scoreModel_menuSelected();
238 public void menuDeselected(MenuEvent e)
243 public void menuCanceled(MenuEvent e)
247 showLabels.setText(MessageManager.getString("label.show_labels"));
248 showLabels.addActionListener(new ActionListener()
251 public void actionPerformed(ActionEvent e)
253 showLabels_actionPerformed(e);
256 JMenuItem bgcolour = new JMenuItem();
257 bgcolour.setText(MessageManager.getString("action.background_colour"));
258 bgcolour.addActionListener(new ActionListener()
261 public void actionPerformed(ActionEvent e)
263 bgcolour_actionPerformed(e);
266 JMenuItem originalSeqData = new JMenuItem();
267 originalSeqData.setText(MessageManager.getString("label.input_data"));
268 originalSeqData.addActionListener(new ActionListener()
271 public void actionPerformed(ActionEvent e)
273 originalSeqData_actionPerformed(e);
276 associateViewsMenu.setText(
277 MessageManager.getString("label.associate_nodes_with"));
278 calcSettings.setText(MessageManager.getString("action.change_params"));
280 .setText(MessageManager.getString("label.nucleotide_matrix"));
281 protSetting.setText(MessageManager.getString("label.protein_matrix"));
282 nuclSetting.addActionListener(new ActionListener()
286 public void actionPerformed(ActionEvent arg0)
288 nuclSetting_actionPerfomed(arg0);
291 protSetting.addActionListener(new ActionListener()
295 public void actionPerformed(ActionEvent arg0)
297 protSetting_actionPerfomed(arg0);
301 calcSettings.add(nuclSetting);
302 calcSettings.add(protSetting);
303 calcSettings.add(scoreModelMenu);
304 statusPanel.setLayout(new GridLayout());
305 statusBar.setFont(VERDANA_12);
306 // statusPanel.setBackground(Color.lightGray);
307 // statusBar.setBackground(Color.lightGray);
308 // statusPanel.add(statusBar, null);
309 JPanel panelBar = new JPanel(new BorderLayout());
310 panelBar.add(jPanel2, BorderLayout.NORTH);
311 panelBar.add(statusPanel, BorderLayout.SOUTH);
312 this.getContentPane().add(panelBar, BorderLayout.SOUTH);
313 jPanel2.add(jLabel1, null);
314 jPanel2.add(xCombobox, null);
315 jPanel2.add(jLabel2, null);
316 jPanel2.add(yCombobox, null);
317 jPanel2.add(jLabel3, null);
318 jPanel2.add(zCombobox, null);
319 jPanel2.add(resetButton, null);
321 JMenuBar jMenuBar1 = new JMenuBar();
322 jMenuBar1.add(fileMenu);
323 jMenuBar1.add(viewMenu);
324 jMenuBar1.add(calcSettings);
325 setJMenuBar(jMenuBar1);
326 fileMenu.add(saveMenu);
327 fileMenu.add(outputValues);
329 fileMenu.add(originalSeqData);
330 fileMenu.add(outputPoints);
331 fileMenu.add(outputProjPoints);
334 viewMenu.add(showLabels);
335 viewMenu.add(bgcolour);
336 viewMenu.add(associateViewsMenu);
339 protected void scoreModel_menuSelected()
341 // TODO Auto-generated method stub
345 protected void resetButton_actionPerformed(ActionEvent e)
347 // TODO Auto-generated method stub
351 protected void protSetting_actionPerfomed(ActionEvent arg0)
353 // TODO Auto-generated method stub
357 protected void nuclSetting_actionPerfomed(ActionEvent arg0)
359 // TODO Auto-generated method stub
363 protected void outputPoints_actionPerformed(ActionEvent e)
365 // TODO Auto-generated method stub
369 protected void outputProjPoints_actionPerformed(ActionEvent e)
371 // TODO Auto-generated method stub
375 protected void xCombobox_actionPerformed(ActionEvent e)
379 protected void yCombobox_actionPerformed(ActionEvent e)
383 protected void zCombobox_actionPerformed(ActionEvent e)
387 public void eps_actionPerformed(ActionEvent e)
392 public void png_actionPerformed(ActionEvent e)
397 public void outputValues_actionPerformed(ActionEvent e)
402 public void print_actionPerformed(ActionEvent e)
407 public void showLabels_actionPerformed(ActionEvent e)
412 public void bgcolour_actionPerformed(ActionEvent e)
417 public void originalSeqData_actionPerformed(ActionEvent e)
422 public void viewMenu_menuSelected()