When trying to compile the code below:
import javax.swing.*;
import sun.audio.*;
import com.sun.java.util.*;
import java.awt.*;
import java.awt.Event.*;
import java.io.*;
public class filechus {
public static void main(String[]args) {
JFrame tela = new JFrame("Telex");
JFileChooser filex = new JFileChooser();
int opcao = filex.showOpenDialog(tela);
if (opcao==JFileChooser.APPROVE_OPTION) {
File nomearquivo = filex.getSelectedFile();
try {
InputStream arq = new FileInputStream(nomearquivo);
AudioStream som = new AudioStream(arq);
AudioPlayer.player.start(som);
System.out.println("Tocando");
}
catch(Exception e) {
System.out.println("Deu erro");
}
}
tela.setBounds(10,10,800,600);
tela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tela.setVisible(true);
}
}
I get the following error message:
AudioPlayer is internal proprietary api and may be removed in a future release
How can I resolve this?