01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: /*
09: * Created on 03.03.2005
10: */
11: package de.uka.ilkd.key.gui.notification.actions;
12:
13: import java.net.URL;
14:
15: import de.uka.ilkd.key.gui.notification.NotificationAction;
16: import de.uka.ilkd.key.gui.notification.events.NotificationEvent;
17: import de.uka.ilkd.key.util.Debug;
18:
19: /**
20: * This notification action plays a sound.
21: * @author bubel
22: */
23: public class PlaySound implements NotificationAction {
24:
25: /** the URL where to find the sound file to play */
26: private URL soundURL;
27:
28: public PlaySound() {
29: }
30:
31: /**
32: * sets the URL pointing to the location of the sound to be played
33: * @param url the URL refering to the sound to be played
34: */
35: public void setSoundURL(URL url) {
36: this .soundURL = url;
37: }
38:
39: /**
40: * plays the sound
41: * @see de.uka.ilkd.key.gui.notification.NotificationAction#execute(NotificationEvent)
42: */
43: public boolean execute(NotificationEvent event) {
44: if (soundURL != null) {
45: java.applet.Applet.newAudioClip(soundURL).play();
46: return true;
47: }
48: Debug.out("No sound file found.");
49: return false;
50: }
51:
52: }
|