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
Plan your Crypto & Forex entries before you take the trade
romeshnonis
Updated:
Today at 3:20 AM
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Tuesday at 10:28 AM
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Sep 7, 2026
Ad icon
Professional CCTV Installation Service
Techguy231
Updated:
Sep 6, 2026
Ad icon
I'll research & write an article - Rs. 2000 onwards
Blogerwiki
Updated:
Sep 3, 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
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom