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.
23 import java.awt.BorderLayout;
24 import java.awt.Color;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
28 import javax.swing.JButton;
29 import javax.swing.JFrame;
30 import javax.swing.JLabel;
31 import javax.swing.JPanel;
33 public class MenuChooser implements ActionListener
35 public static boolean protein;
37 private JFrame choosemenu = new JFrame("Animation");
39 private JButton bouton = new JButton("bouton 1");
41 private JButton bouton2 = new JButton("bouton 2");
43 private JPanel container = new JPanel();
45 private JLabel label = new JLabel("Le JLabel");
50 choosemenu.setSize(300, 300);
51 choosemenu.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
52 choosemenu.setLocationRelativeTo(null);
54 container.setBackground(Color.white);
55 container.setLayout(new BorderLayout());
57 // On ajoute notre Fenetre à la liste des auditeurs de notre Bouton
58 bouton.addActionListener(this);
59 bouton2.addActionListener(this);
61 JPanel south = new JPanel();
64 container.add(south, BorderLayout.SOUTH);
66 // On change la couleur de police
67 label.setForeground(Color.blue);
68 // Et on change l'alignement du texte grâce aux attributs static de la
70 label.setHorizontalAlignment(JLabel.CENTER);
72 container.add(label, BorderLayout.NORTH);
74 choosemenu.setContentPane(container);
75 choosemenu.setVisible(true);
81 // *******************************************************************************
82 // LA VOILAAAAAAAAAAAAAA
83 // *******************************************************************************
85 * C'est la méthode qui sera appelée lors d'un clic sur notre bouton
87 public void actionPerformed(ActionEvent arg0)
90 if (arg0.getSource() == bouton)
92 label.setText("RNA menu");
94 if (arg0.getSource() == bouton2)
95 label.setText("Protein menu");