java音樂播放器-樂樂音樂播放器
樂樂音樂目前是基于musique開發的一個java音樂播放器,支持桌面歌詞,卡拉ok歌詞。詳細請移步到我的博客。
http://my.oschina.net/u/437124/blog/598749
</div>
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);
}
}
}
}
本文由用戶 ChaTisdale 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!