Clover icon

Coverage Report

  1. Project Clover database Fri Dec 6 2024 13:47:14 GMT
  2. Package jalview.gui

File MenuChooser.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
60% of files have more coverage

Code metrics

4
22
2
1
99
46
4
0.18
11
2
2

Classes

Class Line # Actions
33 22 4
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.gui;
22   
23    import java.awt.BorderLayout;
24    import java.awt.Color;
25    import java.awt.event.ActionEvent;
26    import java.awt.event.ActionListener;
27   
28    import javax.swing.JButton;
29    import javax.swing.JFrame;
30    import javax.swing.JLabel;
31    import javax.swing.JPanel;
32   
 
33    public class MenuChooser implements ActionListener
34    {
35    public static boolean protein;
36   
37    private JFrame choosemenu = new JFrame("Animation");
38   
39    private JButton bouton = new JButton("bouton 1");
40   
41    private JButton bouton2 = new JButton("bouton 2");
42   
43    private JPanel container = new JPanel();
44   
45    private JLabel label = new JLabel("Le JLabel");
46   
 
47  0 toggle public MenuChooser()
48    {
49   
50  0 choosemenu.setSize(300, 300);
51  0 choosemenu.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
52  0 choosemenu.setLocationRelativeTo(null);
53   
54  0 container.setBackground(Color.white);
55  0 container.setLayout(new BorderLayout());
56   
57    // On ajoute notre Fenetre à la liste des auditeurs de notre Bouton
58  0 bouton.addActionListener(this);
59  0 bouton2.addActionListener(this);
60   
61  0 JPanel south = new JPanel();
62  0 south.add(bouton);
63  0 south.add(bouton2);
64  0 container.add(south, BorderLayout.SOUTH);
65   
66    // On change la couleur de police
67  0 label.setForeground(Color.blue);
68    // Et on change l'alignement du texte grâce aux attributs static de la
69    // classe JLabel
70  0 label.setHorizontalAlignment(JLabel.CENTER);
71   
72  0 container.add(label, BorderLayout.NORTH);
73   
74  0 choosemenu.setContentPane(container);
75  0 choosemenu.setVisible(true);
76   
77    }
78   
79    // ...
80   
81    // *******************************************************************************
82    // LA VOILAAAAAAAAAAAAAA
83    // *******************************************************************************
84    /**
85    * C'est la méthode qui sera appelée lors d'un clic sur notre bouton
86    */
 
87  0 toggle public void actionPerformed(ActionEvent arg0)
88    {
89   
90  0 if (arg0.getSource() == bouton)
91  0 protein = false;
92  0 label.setText("RNA menu");
93   
94  0 if (arg0.getSource() == bouton2)
95  0 label.setText("Protein menu");
96  0 protein = true;
97    }
98   
99    }