当前位置:   article > 正文

java 加入音乐,向Java程序添加音乐/声音

java.io.ioexception: could not create audio stream from input stream

I'm making some mini java games and I was wondering how I can add sound/music to my programs. I watched a video on youtube and followed the code provided, however I get the following error:

java.io.IOException: could not create audio stream from input stream

I noticed that others have asked the same question with the same code but the answers were not helpful. Here is the code:

import sun.audio.*;

import javax.swing.*;

import java.awt.event.*;

import java.io.*;

public class Project1

{

public static void main(String[] args)

{

JFrame frame = new JFrame();

frame.setSize(200,200);

frame.setLocationRelativeTo(null);

JButton button = new JButton("Click me");

frame.add(button);

button.addActionListener(new AL());

frame.setVisib

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/759675
推荐阅读
相关标签
  

闽ICP备14008679号