开发者

how to add sound effects to a Groovy / SwingBuilder application?

开发者 https://www.devze.com 2023-01-17 17:40 出处:网络
I\'ve created a desktop application using Groovy and SwingBuil开发者_如何学Pythonder. I would like to add sound effects to my app.

I've created a desktop application using Groovy and SwingBuil开发者_如何学Pythonder. I would like to add sound effects to my app. How can I do that ?

Thank you...


There is nothing specific in groovy that you could use to add sound effect. Instead just use the existing Java libraries like this:

import  sun.audio.*;
import  java.io.*;

AudioStream as = new AudioStream(new FileInputStream(Filename));         
AudioPlayer.player.start(as);            

Encapsulate this code in a separate class and call it from your groovy application.

0

精彩评论

暂无评论...
验证码 换一张
取 消