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.Font; |
24 |
|
import java.awt.event.ActionListener; |
25 |
|
|
26 |
|
import javax.swing.AbstractButton; |
27 |
|
import javax.swing.ButtonGroup; |
28 |
|
import javax.swing.JRadioButton; |
29 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 14 |
Complexity Density: 0.61 |
|
30 |
|
public class JalviewBooleanRadioButtons extends AbstractButton |
31 |
|
{ |
32 |
|
private static final Font LABEL_FONT = JvSwingUtils.getLabelFont(); |
33 |
|
|
34 |
|
private ButtonGroup buttonGroup = new ButtonGroup(); |
35 |
|
|
36 |
|
private JRadioButton buttonTrue = new JRadioButton(); |
37 |
|
|
38 |
|
private JRadioButton buttonFalse = new JRadioButton(); |
39 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
40 |
0 |
public JalviewBooleanRadioButtons(boolean value, String trueLabel,... |
41 |
|
String falseLabel) |
42 |
|
{ |
43 |
0 |
init(); |
44 |
0 |
this.setLabels(trueLabel, falseLabel); |
45 |
|
} |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
47 |
0 |
public JalviewBooleanRadioButtons(boolean value)... |
48 |
|
{ |
49 |
0 |
init(); |
50 |
0 |
setSelected(value); |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
0 |
public JalviewBooleanRadioButtons()... |
54 |
|
{ |
55 |
0 |
init(); |
56 |
|
} |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
58 |
0 |
protected void init()... |
59 |
|
{ |
60 |
0 |
buttonTrue.setFont(LABEL_FONT); |
61 |
0 |
buttonFalse.setFont(LABEL_FONT); |
62 |
0 |
buttonGroup.add(buttonTrue); |
63 |
0 |
buttonGroup.add(buttonFalse); |
64 |
|
} |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
66 |
0 |
public void setLabels(String trueLabel, String falseLabel)... |
67 |
|
{ |
68 |
0 |
buttonTrue.setText(trueLabel); |
69 |
0 |
buttonFalse.setText(falseLabel); |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
72 |
0 |
@Override... |
73 |
|
public void setSelected(boolean b) |
74 |
|
{ |
75 |
0 |
buttonFalse.setSelected(!b); |
76 |
|
|
77 |
|
|
78 |
0 |
buttonTrue.setSelected(b); |
79 |
|
} |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0 |
@Override... |
82 |
|
public boolean isSelected() |
83 |
|
{ |
84 |
|
|
85 |
0 |
return buttonTrue.isSelected() && !buttonFalse.isSelected(); |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
88 |
0 |
@Override... |
89 |
|
public void setEnabled(boolean b) |
90 |
|
{ |
91 |
0 |
buttonTrue.setEnabled(b); |
92 |
0 |
buttonFalse.setEnabled(b); |
93 |
|
} |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
0 |
@Override... |
96 |
|
public boolean isEnabled() |
97 |
|
{ |
98 |
0 |
return buttonTrue.isEnabled() && buttonFalse.isEnabled(); |
99 |
|
} |
100 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
0 |
public JRadioButton getTrueButton()... |
102 |
|
{ |
103 |
0 |
return buttonTrue; |
104 |
|
} |
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0 |
public JRadioButton getFalseButton()... |
107 |
|
{ |
108 |
0 |
return buttonFalse; |
109 |
|
} |
110 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
111 |
0 |
@Override... |
112 |
|
public void addActionListener(ActionListener l) |
113 |
|
{ |
114 |
0 |
buttonTrue.addActionListener(l); |
115 |
0 |
buttonFalse.addActionListener(l); |
116 |
|
} |
117 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
0 |
public void addTrueActionListener(ActionListener l)... |
119 |
|
{ |
120 |
0 |
buttonTrue.addActionListener(l); |
121 |
|
} |
122 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
0 |
public void addFalseActionListener(ActionListener l)... |
124 |
|
{ |
125 |
0 |
buttonFalse.addActionListener(l); |
126 |
|
} |
127 |
|
} |