|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CheckboxTester.java | 25% | 28.6% | 50% | 30.8% |
|
||||||||||||||
| 1 |
package abbot.tester;
|
|
| 2 |
|
|
| 3 |
import java.awt.Checkbox;
|
|
| 4 |
import java.awt.Component;
|
|
| 5 |
import java.awt.event.ItemEvent;
|
|
| 6 |
|
|
| 7 |
/** Provides Checkbox activation support, since otherwise AWT buttons cannot be
|
|
| 8 |
* activated in AWT mode.
|
|
| 9 |
*/
|
|
| 10 |
public class CheckboxTester extends ComponentTester { |
|
| 11 |
/** Programmatically clicks the Checkbox if in AWT mode. */
|
|
| 12 | 2 |
public void click(final Component comp, int x, int y, int mask, int count) { |
| 13 | 2 |
if (getEventMode() == EM_AWT) {
|
| 14 | 0 |
final Checkbox box = (Checkbox)comp; |
| 15 | 0 |
invokeLater(new Runnable() {
|
| 16 | 0 |
public void run() { |
| 17 | 0 |
box.setState(!box.getState()); |
| 18 | 0 |
ItemEvent e = |
| 19 |
new ItemEvent(box, ItemEvent.ITEM_STATE_CHANGED,
|
|
| 20 | 0 |
box, box.getState() ? 1 : 0); |
| 21 | 0 |
postEvent(box, e); |
| 22 |
} |
|
| 23 |
}); |
|
| 24 |
} |
|
| 25 |
else {
|
|
| 26 | 2 |
super.click(comp, x, y, mask, count);
|
| 27 |
} |
|
| 28 |
} |
|
| 29 |
} |
|
| 30 |
|
|
||||||||||