1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 4 |
Complexity Density: 0.18 |
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
|
47 |
0 |
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 |
|
|
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 |
|
|
67 |
0 |
label.setForeground(Color.blue); |
68 |
|
|
69 |
|
|
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 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
87 |
0 |
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 |
|
} |