欢迎来到天天文库
浏览记录
ID:8426349
大小:38.29 KB
页数:13页
时间:2018-03-27
《java课程设计源代码》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、packageui;importjava.awt.EventQueue;//线程分发importjavax.swing.JDialog;importjavax.swing.JFrame;importjavax.swing.UIManager;importjavax.swing.UnsupportedLookAndFeelException;importorg.jvnet.substance.SubstanceLookAndFeel;importmusicPlayer.MusicPanel;publicclassMain{p
2、ublicstaticvoidmain(String[]args){try{//设置观感UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel");//设置水印SubstanceLookAndFeel.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceMangoLookAndFeel");//设置渐变渲染SubstanceLookA
3、ndFeel.setCurrentGradientPainter("org.jvnet.substance.painter.WaveGradientPainter");JFrame.setDefaultLookAndFeelDecorated(true);//窗体JDialog.setDefaultLookAndFeelDecorated(true);//对话框}catch(ClassNotFoundException
4、InstantiationException
5、IllegalAccessException
6、Unsupp
7、ortedLookAndFeelExceptione){e.printStackTrace();//e为对象引用的名称//在命令行打印异常信息在程序中出错的位置及原因}EventQueue.invokeLater(()->{//调用完毕,自动销毁(因为是一个匿名类)newMusicPanel();});}}packagemusicPlayer;importjava.awt.BorderLayout;importjava.awt.Color;importjava.awt.event.ActionEvent;importjav
8、a.awt.event.ActionListener;importjava.io.File;importjava.util.Vector;importjavax.swing.JButton;importjavax.swing.JFileChooser;importjavax.swing.JFrame;importjavax.swing.JPanel;importjavax.swing.JScrollPane;importjavax.swing.JTable;importjavax.swing.filechooser.Fil
9、eNameExtensionFilter;importjavax.swing.table.DefaultTableModel;importplayer.Player;publicclassMusicPanelextendsJFrame{/****/privatestaticfinallongserialVersionUID=1L;privateJButtonadd,playbtn,stopbtn,deletebtn,deleteAllbtn,upbtn,downbtn;privateJTabletable;//歌曲信息表p
10、rivatePlayerplayer;publicMusicPanel(){super("音乐播放器");initCompont();setVisible(true);}/***初始化界面**/privatevoidinitCompont(){// 各个按钮赋初始值add=newJButton("导入");playbtn=newJButton("试听");stopbtn=newJButton("停止");deletebtn=newJButton("单曲删除");deleteAllbtn=newJButton("全部删除")
11、;upbtn=newJButton("上移");downbtn=newJButton("下移");//导入按钮点击设置add.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){addFile();}
此文档下载收益归作者所有