音乐播放器毕业设计 - 图文(8)

2019-06-17 10:15

四川科技职业学院毕业设计(论文)

第 33 页

private void refreshSystem() {

TitlePanel.getInstance().setTheme(themeNumer);

MyMenuBar.getInstance().setMenuBackgroundColor(getBackgroundColor());

MyPopupMenu.getInstance().setBackgroundColor(getBackgroundColor());

BottomPanel bpnl = BottomPanel.getInstance();

bpnl.setBackgroundColor(getForegroundColor()); MySliderUI.setSliderColor(getForegroundColor());

bpnl.getTimeSlider().setUI(new MySliderUI(bpnl.getTimeSlider())); bpnl.getSoundSlider().setUI(new MySliderUI(bpnl.getSoundSlider())); bpnl.getSongNameLabel().setForeground(getListTextColor()); bpnl.getTimeLabel().setForeground(getListTextColor());

MyTabbedPaneUI.setDefaultColor(getForegroundColor());

RightPanel.getInstance().getListTabPnl().setUI(new MyTabbedPaneUI());

RightPanel.getInstance().getListTabPnl().setForeground(getListTextColor());

MyCellRenderer.setForegroundColor(getListTextColor()); MyCellRenderer.setBackgroundColor(getForegroundColor()); MiniMusic.getInstance().setBorderColor(getListTextColor()); MiniMusic.getInstance().repaint(); }

public Color getBackgroundColor() {

return Color.decode(pp.getProperty(\ }

public Color getForegroundColor() {

return Color.decode(pp.getProperty(\ }

四川科技职业学院毕业设计(论文)

第 34 页

public Color getListTextColor() {

return Color.decode(pp.getProperty(\ }

public static MySkin getCurrentSkin() { return mySkin; } }

当点击更换按钮时弹出系统颜色选择器,如图5.3.1

图5.3.1

主要功能实现代码:

public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); if (obj == ccButton) {

Color newColor = JColorChooser.showDialog(this, \更换颜色\ if (newColor != null) {

titlePanel.setSkinColor(newColor); MiniMusic.getInstance().repaint();

四川科技职业学院毕业设计(论文)

第 35 页

} }

5.4 播放按钮详细设计

播放按钮主要包括:上一曲/下一曲,播放/暂停,停止,声音:开/关。如图5.4

主要功能实现代码: /**

* 开始播放音乐 */

public static void start() {

if (player != null && !noCanPlaySong()) {

player.getGainControl().setLevel(soundSlider.getValue() / 100.0F); setSoundState(getSoundState()); player.start(); //进度条更新

SliderUpdateThread.initThread(); SliderUpdateThread.getThread().start(); SliderUpdateThread.resume();

player.addControllerListener(SongControlListener.getInstance()); playerState = PlayerState.PLAY;

psButton.setIcon(new IconTool(\ psButton.setIconPath(\

songNameLabel.setText(currentSong.getSongName()); int index = defaultSongInfo.indexOf(currentSong);

defaultSongList.setSelectedIndex(index);

LRCParse.getInstance().LoadLRC(); LRCLabel.getInstance().refresh();

四川科技职业学院毕业设计(论文)

第 36 页

PlayerInfoLabel.getInstance().refresh();

}

} /**

* 暂停音乐函数 */

public static void pause() { if (player != null) { player.stop();

playerState = PlayerState.PAUSE;

psButton.setIcon(new IconTool(\ psButton.setIconPath(\ PlayerInfoLabel.getInstance().refresh(); } } /**

* 停止播放 */

public static void stop() { if (player != null) {

playerState = PlayerState.UNREALIZED;

psButton.setIcon(new IconTool(\ psButton.setIconPath(\ SliderUpdateThread.pause();

timeSlider.setValue(0);

timeLabel.setText(\

FormatUtils.formatTime(player.getDuration().getSeconds()));

player.close();

PlayerInfoLabel.getInstance().refresh();

四川科技职业学院毕业设计(论文)

第 37 页

}

}

/**

* 清空所有信息 */

public static void clear() { if (player != null) {

playerState = PlayerState.UNREALIZED;

psButton.setIcon(new IconTool(\ psButton.setIconPath(\ SliderUpdateThread.pause(); timeSlider.setValue(0); player.close(); }

timeLabel.setText(\

songNameLabel.setText(\播放列表中没有可以播放的歌曲\

LRCLabel.getInstance().setStandOutSign(0);

} /**

* 下一首歌曲 */

public static void nextSong() { if (noCanPlaySong()) { return; }

int index = defaultSongInfo.indexOf(currentSong); if (index == defaultSongInfo.size() - 1) { index = 0;


音乐播放器毕业设计 - 图文(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:《手工基础》课程教学大纲

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: