Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
JAVA
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="akhilapraveen" data-source="post: 10987535" data-attributes="member: 104181"><p>This is the way,</p><p></p><p>The java sound API is quite advanced and allows for many complex operations.</p><p></p><p>Assuming you want to use a wave file your starting point is AudioSystem in the javax.sound.sampled package (midi is another class/package).</p><p></p><p>In your application initialization:</p><p>1. Get an AudioInputStream from a file/URL or some other input location:</p><p> AudioInputStream audioInput = AudioSystem.getAudioInputStream(MyClass.class.getResource("sound/buttonClick.wav"));</p><p>2. Get a Clip object that can play the sound, this operation can fail if the computer can't play sound:</p><p> private static Clip buttonClickSound;</p><p> ...</p><p> buttonClickSound = AudioSystem.getClip();</p><p>3. Load the audio input into the clip:</p><p> buttonClickSound.open(audioInput);</p><p></p><p>4. Now in your actionPerformed method play the sound:</p><p> buttonClickSound.start();</p><p></p><p>Java only comes with basic audio file support. If you want to play something like an MP3 you will need to obtain a 3rd party library (freely available).</p></blockquote><p></p>
[QUOTE="akhilapraveen, post: 10987535, member: 104181"] This is the way, The java sound API is quite advanced and allows for many complex operations. Assuming you want to use a wave file your starting point is AudioSystem in the javax.sound.sampled package (midi is another class/package). In your application initialization: 1. Get an AudioInputStream from a file/URL or some other input location: AudioInputStream audioInput = AudioSystem.getAudioInputStream(MyClass.class.getResource("sound/buttonClick.wav")); 2. Get a Clip object that can play the sound, this operation can fail if the computer can't play sound: private static Clip buttonClickSound; ... buttonClickSound = AudioSystem.getClip(); 3. Load the audio input into the clip: buttonClickSound.open(audioInput); 4. Now in your actionPerformed method play the sound: buttonClickSound.start(); Java only comes with basic audio file support. If you want to play something like an MP3 you will need to obtain a 3rd party library (freely available). [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom