加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java音乐播放器-乐乐音乐播放器

发布时间:2020-12-15 03:13:40 所属栏目:Java 来源:网络整理
导读:今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 乐乐音乐目前是基于musique开发的一个java音乐播放器,支持桌面歌词,卡拉ok歌词。详细请移步到我的博客。 http://my.oschina.net/u/437124/blog/5987

以下代码由PHP站长网 52php.cn收集自互联网

现在PHP站长网小编把它分享给大家,仅供参考

乐乐音乐目前是基于musique开发的一个java音乐播放器,支持桌面歌词,卡拉ok歌词。详细请移步到我的博客。
http://my.oschina.net/u/437124/blog/598749

111711_BEOg_437124.jpg????

111712_ZLs1_437124.jpg????

EnterProgram.java?~?2KB???? ????

package com.happy.enterProgram;

import java.awt.Font;
import java.util.Enumeration;

import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.FontUIResource;

import com.happy.common.Constants;
import com.happy.manage.MediaManage;
import com.happy.service.MediaPlayerService;
import com.happy.ui.MainFrame;
import com.happy.ui.SplashFrame;
import com.happy.util.DataUtil;
import com.happy.util.FontsUtil;

public class EnterProgram {
	/**
	 * 应用启动窗口
	 */
	private static SplashFrame splashFrame;
	/**
	 * 主窗口
	 */
	private static MainFrame mainFrame;

	/**
	 * 程序入口
	 * 
	 * @throws UnsupportedLookAndFeelException
	 * @throws IllegalAccessException
	 * @throws InstantiationException
	 * @throws ClassNotFoundException
	 * 
	 */
	public static void main(String[] args) throws ClassNotFoundException,InstantiationException,IllegalAccessException,UnsupportedLookAndFeelException {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				splashFrame = new SplashFrame();
				splashFrame.setVisible(true);

				init();
			}
		});

	}

	protected static void init() {

		new SwingWorker<Void,Void>() {
			@Override
			protected Void doInBackground() {

				initGlobalFont(FontsUtil.getBaseFont(Constants.APPFONTSIZE));
				// 先初始化数据
				DataUtil.init();
				// 初始化播放列表数据
				MediaManage.getMediaManage().initPlayListData();
				// 初始化播放器服务
				MediaPlayerService.getMediaPlayerService().init();
				SwingUtilities.invokeLater(new Runnable() {
					public void run() {
						mainFrame = new MainFrame();
						splashFrame.setVisible(false);
						mainFrame.setVisible(true);
					}
				});

				return null;

			}

			@Override
			protected void done() {
			}
		}.execute();

	}

	/**
	 * 统一设置字体,父界面设置之后,所有由父界面进入的子界面都不需要再次设置字体
	 */
	private static void initGlobalFont(Font font) {
		FontUIResource fontRes = new FontUIResource(font);
		for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys
				.hasMoreElements();) {
			Object key = keys.nextElement();
			Object value = UIManager.get(key);
			if (value instanceof FontUIResource) {
				UIManager.put(key,fontRes);
			}
		}
	}
}

以上内容由PHP站长网【52php.cn】收集整理供大家参考研究

如果以上内容对您有帮助,欢迎收藏、点赞、推荐、分享。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读