|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ArrowButtonTester.java | - | 0% | 0% | 0% |
|
1 |
package abbot.tester.extensions;
|
|
2 |
|
|
3 |
import java.awt.*;
|
|
4 |
import java.awt.event.InputEvent;
|
|
5 |
import example.ArrowButton;
|
|
6 |
|
|
7 |
/** Provide user actions and identifiers for the {@link ArrowButton}
|
|
8 |
component. */
|
|
9 |
|
|
10 |
public class ArrowButtonTester extends abbot.tester.ComponentTester { |
|
11 |
|
|
12 |
/** Set up the editor menu documentation properties. */
|
|
13 |
static {
|
|
14 | 0 |
System.setProperty("actionRoll.menu", "Roll"); |
15 | 0 |
System.setProperty("actionRoll.desc", "Hold down the arrow button"); |
16 | 0 |
System.setProperty("ArrowButtonTester.actionRoll.args",
|
17 |
"actionRoll(Component comp, int ms)");
|
|
18 |
} |
|
19 |
|
|
20 |
// NOTE: while deprecated, there is not currently in place a replacement
|
|
21 |
// for noting one or more unique attributes of custom components, so for
|
|
22 |
// now, this will do, but you are restricted to a single tag.
|
|
23 | 0 |
public String deriveTag(Component comp) {
|
24 | 0 |
return ((ArrowButton)comp).getDirection();
|
25 |
} |
|
26 |
|
|
27 |
/** Press and hold the button for the given length of time (in ms). */
|
|
28 | 0 |
public void actionRoll(Component comp, int ms) { |
29 | 0 |
Dimension size = comp.getSize(); |
30 | 0 |
mousePress(comp, (size.width + 1) / 2, (size.height + 1) / 2, |
31 |
InputEvent.BUTTON1_MASK); |
|
32 | 0 |
delay(ms); |
33 | 0 |
mouseRelease(InputEvent.BUTTON1_MASK); |
34 |
} |
|
35 |
} |
|
36 |
|
|