欢迎来到天天文库
浏览记录
ID:11197144
大小:43.51 KB
页数:7页
时间:2018-07-10
《java简单播放器源码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、importjava.awt.BorderLayout;importjavax.media.Manager;importjavax.media.NoPlayerException;importjavax.media.Player;importjavax.sound.sampled.AudioFormat;importjavax.sound.sampled.AudioSystem;importjavax.sound.sampled.DataLine;importjavax.sound.sampled.SourceDataLine;importjavax.
2、swing.ImageIcon;importjavax.swing.JFileChooser;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JFrame;importjavax.swing.JScrollPane;importjava.awt.Rectangle;importjavax.swing.JTable;importjava.awt.Dimension;importjavax.swing.JTextPane;importjavax.swing.JScrol
3、lBar;importjava.awt.List;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.io.File;importjava.io.IOException;importjava.net.MalformedURLException;importjavax.swing.JButton;importjavax.swing.filechooser.FileNameExtensionFilter;publicclassHelloextends
4、JFrameimplementsActionListener{privatestaticfinallongserialVersionUID=1L;privateJPaneljContentPane=null;privateListlist=null;privateJButtonjButton=null;privatePlayerplay;//@jve:decl-index=0:privateStringstr=null;privateJButtonjButton1=null;privateJButtonjButton2=null;privatebool
5、eanb=false;privatestaticSourceDataLineobjSDL;privateJButtonjButton3=null;/***Thisisthedefaultconstructor*/publicHello(){super();ImageIconbackIcon=newImageIcon(getClass().getResource("/image/hehe.jpg"));finalJLabelbackLabel=newJLabel(backIcon);//创建背景标签backLabel.setSize(backIcon.g
6、etIconWidth(),backIcon.getIconHeight());backLabel.setLocation(0,0);this.add(backLabel);initialize();}/***Thismethodinitializesthis**@returnvoid*/privatevoidinitialize(){this.setSize(594,346);this.setContentPane(getJContentPane());this.setTitle("达达播放器");setVisible(true);}/***This
7、methodinitializesjContentPane**@returnjavax.swing.JPanel*///StartOutput/***打开音频设备.*@paramintFreq采样率。*@paramiBitsPCM位深(例如16)。*@paramchannels声道数*/privateJPanelgetJContentPane(){if(jContentPane==null){jContentPane=newJPanel();jContentPane.setLayout(null);jContentPane.add(getList(),
8、null);jContentPane.add(getJButton(),null);jCont
此文档下载收益归作者所有