java音乐播放器文库_基于java的音乐播放器的设计(源代码+实验报告)

这个博客介绍了如何使用Java编程实现一个音乐播放器,包括主类MUSICPLAYER的详细设计,涵盖了播放、暂停、前后曲切换等功能。还涉及到文件选择、播放模式设置以及界面布局等交互元素的实现。源代码和实验报告一并提供。
摘要由CSDN通过智能技术生成

41528d3028836879cd698677c3999917.gif基于java的音乐播放器的设计(源代码+实验报告)

主类MUSICPLAYER类: import java.util.*; import javax.swing.JSlider; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectStream; import java.io.ObjectOutputStream; import java.io.Serializable; import javax.media.ControllerEvent; import javax.media.ControllerListener; import javax.media.EndOfMediaEvent; import javax.media.Manager; import javax.media.MediaLocator; import javax.media.NoPlayerException; import javax.media.Player; import javax.media.PrefetchCompleteEvent; import javax.media.Time; import javax.swing.ButtonGroup; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButtonMenuItem; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.filechooser.FileNameExtensionFilter; public class MusicPlayer implements ActionListener, Serializable,ControllerListener { private static final long serialVersionUID = 1L; private JFrame frame = null; private JPanel controlPanel = null; private JButton btnPlay = null; private JButton btnPre = null; private JButton btnNext = null; private JScrollPane listPane = null; private JList list = null; private DefaultListModel listModel = null; private JMenuBar menubar = null; private JMenu menuFile = null, menuAbout = null, menuMode = null; private JMenuItem itemOpen, itemOpens, itemExit, itemAbout; private JRadioButtonMenuItem itemSingle, itemSequence ,itemRandom; private ListItem currentItem = null; private static Player player = null; private boolean isPause = false; private int mode; private int currentIndex; private ImageIcon iconPlay = new ImageIcon(“d:\\1.jpg“); private ImageIcon iconPre = new ImageIcon(“d:\\3.jpg“); private ImageIcon iconNext = new ImageIcon(“d:\\2.jpg“); private ImageIcon iconPause = new ImageIcon(“d:\\4.jpg“); public static void main(String[] args) { new MusicPlayer(); } public MusicPlayer() { init(); } public void init() { frame = new JFrame(); frame.setTitle(“音乐播放器“); frame.setSize(400, 300); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); menubar = new JMenuBar(); menuFile = new JMenu(“文件“); menuAbout = new JMenu(“关于“); menuMode = new JMenu(“播放模式“); itemOpen = new JMenuItem(“添加文件“);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值