01: package abbot.tester;
02:
03: import java.awt.Checkbox;
04: import java.awt.Component;
05: import java.awt.event.ItemEvent;
06:
07: /** Provides Checkbox activation support, since otherwise AWT buttons cannot be
08: * activated in AWT mode.
09: */
10: public class CheckboxTester extends ComponentTester {
11: /** Programmatically clicks the Checkbox if in AWT mode. */
12: public void click(final Component comp, int x, int y, int mask,
13: int count) {
14: if (getEventMode() == EM_AWT) {
15: final Checkbox box = (Checkbox) comp;
16: invokeLater(new Runnable() {
17: public void run() {
18: box.setState(!box.getState());
19: ItemEvent e = new ItemEvent(box,
20: ItemEvent.ITEM_STATE_CHANGED, box, box
21: .getState() ? 1 : 0);
22: postEvent(box, e);
23: }
24: });
25: } else {
26: super.click(comp, x, y, mask, count);
27: }
28: }
29: }
|