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 package org.ximtec.igesture.app.showcaseapp.eventhandler;
28
29 import java.awt.BasicStroke;
30 import java.awt.Color;
31
32 import org.ximtec.igesture.app.showcaseapp.Style;
33 import org.ximtec.igesture.core.ResultSet;
34 import org.ximtec.igesture.event.GestureAction;
35
36
37
38
39
40
41
42 public class StyleEventHandler implements GestureAction {
43
44 private Style style;
45
46
47 public StyleEventHandler(Style style) {
48 this.style = style;
49 }
50
51
52 public void actionPerformed(ResultSet resultSet) {
53 String command = resultSet.getResult().getGestureClassName();
54
55 if (command.equals("Red")) {
56 style.setColor(Color.RED);
57 }
58 else if (command.equals("Black")) {
59 style.setColor(Color.BLACK);
60 }
61 else if (command.equals("Yellow")) {
62 style.setColor(Color.YELLOW);
63 }
64 else if (command.equals("Thin")) {
65 style.setStroke(new BasicStroke(1.0f));
66 }
67 else if (command.equals("Fat")) {
68 style.setStroke(new BasicStroke(3.0f));
69 }
70
71 }
72
73 }