blob: 3559e0404590ae217d8693797e41b71e76102021 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package gjt;
import java.awt.Event;
import java.awt.Graphics;
/**
* An ImageButtonController that reacts to mouseDown/mouseUp
* events exactly as a java.awt.Button does.<p>
*
* @version 1.0, Apr 1 1996
* @author David Geary
* @see ImageButton
* @see ImageButtonController
* @see StickyImageButtonController
*/
public class SpringyImageButtonController
extends ImageButtonController {
public SpringyImageButtonController(ImageButton ib) {
super(ib);
}
public boolean mouseDown(Event event, int x, int y) {
if(event.modifiers == 0) {
getButton().paintInset();
armButton(event);
}
return false;
}
public boolean mouseUp(Event event, int x, int y) {
if(event.modifiers == 0) {
if(getButton().isRaised() == false) {
getButton().paintRaised();
activateButton(event);
}
}
return false;
}
public boolean mouseDrag(Event event, int x, int y) {
if(event.modifiers == 0) {
if(getButton().isInside(x,y)) {
if(getButton().isRaised()) {
getButton().paintInset();
armButton(event);
}
}
else {
if(getButton().isRaised() == false) {
getButton().paintRaised();
disarmButton(event);
}
}
}
return false;
}
}
|