Java-迷你乐透Wav
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java-迷你乐透Wav相关的知识,希望对你有一定的参考价值。
package Multimedia; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.MetalLookAndFeel; { { try { } { e.printStackTrace(); } new AudioGUI(); } } package Multimedia; import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.File; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JPanel; { public AudioGUI() { this.setTitle("AudioSystem"); this.setSize(240, 100); this.setResizable(false); this.addWindowListener(this); gc.add(new AudioGUIPan()); this.setVisible(true); } { } { } { } { } { } { } { } } { private AudioDevice ad; public AudioGUIPan() { play.addActionListener(this); stop.addActionListener(this); open.addActionListener(this); close.addActionListener(this); this.add(stop); this.add(play); this.add(open); this.add(close); } { if(e.getSource() == close) { } else if(e.getSource() == open) { jfc.setFileFilter(new AudioFilter()); { file = jfc.getSelectedFile().getAbsolutePath(); } } else if(e.getSource() == play) { if(ad != null) ad.play(); } else if(e.getSource() == stop) { if(ad != null) ad.stop(); } } } package Multimedia; import java.io.File; import javax.swing.filechooser.FileFilter; { { return f.getName().toLowerCase().endsWith(".wav") || f.isDirectory(); } { return "Audio File *.wav"; } } package Multimedia; import java.applet.Applet; import java.applet.AudioClip; import java.io.File; import java.net.MalformedURLException; { { try { } { e.printStackTrace(); } } public void play() { ac.play(); } public void stop() { ac.stop(); } public void loop() { } }
以上是关于Java-迷你乐透Wav的主要内容,如果未能解决你的问题,请参考以下文章