![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2005
Posts: 17
Rep Power: 0
![]() |
Implementing Sounds?
How would I implement sounds to my applet along with MouseListeners?
ex. Would this work? import java.applet.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.util.*; public class Selection extends Applet implements ItemListener, MouseListener, MouseMotionListener {-code- ... ... } I basically want sound to play when a user hovers his mouse over an object. Best regards, Ben. :banana: |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Jan 2006
Location: Dallas, TX
Posts: 49
Rep Power: 0
![]() |
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Oct 2005
Posts: 29
Rep Power: 0
![]() |
The AudioClip class uses Applets to load a music.
First declare your new AudioClip object: private AudioClip sound; Then load it: sound = Applet.newAudioClip(this.getClass().getResource("sound.wav"));When your mouse is within a region, just play the sound: sound.play(); |
|
|
|
|
|
#4 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
@Bae: use code tags next time.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|