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 package org.ximtec.igesture.app.showcaseapp.eventhandler;
27
28 import java.io.IOException;
29
30 import javax.sound.sampled.AudioSystem;
31 import javax.sound.sampled.UnsupportedAudioFileException;
32
33 import org.sigtec.sound.SoundTool;
34 import org.ximtec.igesture.core.ResultSet;
35 import org.ximtec.igesture.event.GestureAction;
36
37
38
39
40
41
42 public class RejectEventHandler implements GestureAction {
43
44 private static final String RESOURCES_SOUND_RINGOUT_WAV = "sound/ringout.wav";
45
46 private String filename;
47
48 public RejectEventHandler(String filename) {
49 this.filename = filename;
50 }
51
52 public RejectEventHandler() {
53 this(RESOURCES_SOUND_RINGOUT_WAV);
54 }
55
56 public void actionPerformed(ResultSet resultSet) {
57 try {
58 SoundTool.play(AudioSystem.getAudioInputStream(ClassLoader
59 .getSystemResourceAsStream(filename)));
60 } catch (UnsupportedAudioFileException e) {
61 e.printStackTrace();
62 } catch (IOException e) {
63 e.printStackTrace();
64 }
65 }
66
67 }