package player.user;
import java.awt.*;
import player.skin.Skin;
import com.borland.jbcl.layout.*;
import eb.cstop.swing.*;
import player.module.*;
import eb.cstop.swt.*;
import javax.swing.*;
import java.awt.event.*;
import player.core.*;
import java.util.ArrayList;
import java.io.File;
public class CrystalPlayer extends RectangleFrame implements ProgressBarListener,VolumeBarListener,ActionListener,TrayIconListener{
private ImagePanel contentPanel = new ImagePanel("BlackPlayer.png");
private ImageButton doPlay = new ImageButton("Play.png","Play");
private ImageButton doPause = new ImageButton("Pause.png","Pause");
private ImageButton doStop = new ImageButton("Stop.png","Stop");
private ImageButton doFile = new ImageButton("File.png","Files");
private ImageButton doFront = new ImageButton("Front.png","Front");
private ImageButton doNext = new ImageButton("Next.png","Next");
private ImageButton doClose = new ImageButton("Close.png","Close");
private ImageButton doMini = new ImageButton("Mini.png","Mini");
private ImageButton doList = new ImageButton("List.png","FileList");
private ImageButton doVideo = new ImageButton("Video.png","Video");
private ImageButton doLyrics = new ImageButton("Lyrics.png","Lyrics");
private ImageButton doSkin = new ImageButton("Skin.png","Skin");
private TrayIcon trayIcon = TrayIcon.createTrayIcon();
private ProgressBar progress = new ProgressBar();
private ShapeLabel muiscName = new ShapeLabel("Cold Eyes - CrystalPlayer");
private ShapeLabel time = new ShapeLabel("00 : 00 - 00 : 00",false);
private ShapeLabel sampleRate = new ShapeLabel("00KHz",false);
private ShapeLabel sample = new ShapeLabel("100kbps",false);
private VolumeBar volume = new VolumeBar();
private CrystalList list = new CrystalList(this);
private CrystalLyrics lyrics = new CrystalLyrics(this);
private CrystalVideo video = new CrystalVideo(this);
private Core core = new Core(this);
private CrystalLyricsList lyricsList = new CrystalLyricsList(this);
private CrystalSkin skin = new CrystalSkin(this);
private boolean next = true;
private boolean isShowLyrics = true;
static{
Font font = new Font("宋体",0,12);
UIManager.put("Button.font",font);
UIManager.put("Label.font",font);
UIManager.put("Diaglog.font",font);
UIManager.put("List.font",font);
UIManager.put("ComboBox.font",font);
UIManager.put("CheckBox.font",font);
UIManager.put("MenuItem.font",font);
UIManager.put("ScrollBar.width",new Integer(0));
}
public static void main(String[] args){
new CrystalPlayer();
}
public CrystalPlayer() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
progress.addProgressBarListener(this);
volume.addVolumeBarListener(this);
volume.setMaxLimit(100);
new StatusAdapter(this);
doSkin.addActionListener(this);
doPlay.addActionListener(this);
doPause.addActionListener(this);
doStop.addActionListener(this);
doFile.addActionListener(this);
doFront.addActionListener(this);
doNext.addActionListener(this);
doClose.addActionListener(this);
doMini.addActionListener(this);
doList.addActionListener(this);
doVideo.addActionListener(this);
doLyrics.addActionListener(this);
time.setDrawFont(new Font("System",1,12));
time.setDrawX(2);
time.setAlpha(0.6f);
sampleRate.setDrawFont(new Font("Tahoma",0,9));
sampleRate.setDrawX(5);
sample.setDrawFont(new Font("Tahoma",0,9));
sample.setDrawX(1);
if(System.getProperty("java.version").startsWith("1.4"))volume.setMaxLimit(100);
else volume.setMaxLimit(75);
progress.setAlpha(0.6f);
progress.setBorderColor(Color.white);
progress.setColor(Color.white);
trayIcon.setImageIcon(Skin.getDefaultImageIcon("TrayIcon.png"));
trayIcon.setTrayIconToolTip("CrystalPlayer");
trayIcon.addTrayIconListener(this);
this.setResizable(false);
this.getContentPane().setLayout(new BorderLayout());
contentPanel.setLayout(new XYLayout());
volume.setValue(volume.getMaxLimit());
volume.setColor(Color.white);
volume.setAlpha(0.75f);
this.getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.add(doClose, new XYConstraints(189, 6, 5, 5));
contentPanel.add(doMini, new XYConstraints(180, 6, 5, 5));
contentPanel.add(muiscName, new XYConstraints(10, 7, 100, 16));
contentPanel.add(time, new XYConstraints(10, 21, 100, 16));
contentPanel.add(sampleRate, new XYConstraints(110, 7, 36, 16));
contentPanel.add(sample, new XYConstraints(110, 21, 36, 16));
contentPanel.add(volume, new XYConstraints(153, 14, -1, -1));
contentPanel.add(doPlay, new XYConstraints(6, 48, 28, 14));
contentPanel.add(doPause, new XYConstraints(38, 48, 30, 14));
contentPanel.add(doStop, new XYConstraints(70, 48, 30, 14));
contentPanel.add(doFile, new XYConstraints(102, 48, 30, 14));
contentPanel.add(doFront, new XYConstraints(134, 48, 30, 14));
contentPanel.add(doNext, new XYConstraints(166, 48, 30, 14));
contentPanel.add(progress, new XYConstraints(6, 41, 188, -1));
contentPanel.add(doVideo, new XYConstraints(6, 63, 60, 14));
contentPanel.add(doLyrics, new XYConstraints(134, 63, 30, 14));
contentPanel.add(doList, new XYConstraints(70, 63, 60, 14));
contentPanel.add(doSkin, new XYConstraints(166, 63, 30, 14));
this.setTitle("CrystalPlayer");
this.setIconImage(Skin.getDefaultImageIcon("TrayIcon.png").getImage());
this.setSize(200, 80);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = getSize();
this.setLocation((screenSize.width - frameSize.width) / 2,(screenSize.height - frameSize.height) / 2);
ArrayList muiscList = CrystalList.getList();
File[] files = new File[muiscList.size()];
for(int i=0;i<files.length;i++){
files[i] = (File)muiscList.get(i);
}
list.addItems(files,false);
this.setVisible(true);
list.setLocation(this.getLocation().x ,this.getLocation().y + 81);
list.setVisible(true);
lyrics.setLocation(this.getLocation().x + 201,this.getLocation().y);
video.setLocation(this.getLocation().x - 301,this.getLocation().y);
skin.setLocation(this.getLocation().x + 201,this.getLocation().y);
trayIcon.show();
}
public CrystalVideo getVideo(){
return video;
}
public CrystalLyrics getLyrics(){
return lyrics;
}
public boolean isNext() {
return next;
}
public CrystalLyricsList getLyricsList() {
return lyricsList;
}
public void readMuisc(Muisc muisc){
muiscName.setDrawX(2);
if(muisc != null){
if (muisc.getSinger().length() > 0) muiscName.setString(muisc.getSinger() +" - " + muisc.getName());
else muiscName.setString(muisc.getName());
sample.setString(muisc.getBitRate());
sampleRate.setString(muisc.getSampleRate());
}
else{
time.setString("00 : 00 - 00 : 00");
muiscName.setString("Cold Eyes - CrystalPlayer");
sampleRate.setString("00KHz");
sample.setString("000kbps");
}
}
public void setMediaTime(String info){
time.setString(info);
}
public ProgressBar getProgressBar(){
return progress;
}
public void quit(){
trayIcon.close();
System.exit(0);
}
public void playSelected(){
next = true;
this.play(list.getSelectedItem());
}
public void next(){
if(next && list.getRowCount() > 0){
int index = list.getSelectedIndex();
if(index + 1 < list.getRowCount())list.setSelectedIndex(index + 1);
else list.setSelectedIndex(0);
this.playSelected();
}
}
public void front(){
if(list.getRowCount() > 0){
int i
没有合适的资源?快使用搜索试试~ 我知道了~
Java仿千千静听音乐播放器源代码
共212个文件
png:63个
class:61个
java:53个
3星 · 超过75%的资源 需积分: 4 22 下载量 11 浏览量
2010-07-17
23:23:52
上传
评论
收藏 7.26MB ZIP 举报
温馨提示
用Java做得超牛比的播放器,跟千千静听可媲美。值得学习的代码。学习音频的Java爱好者不可不看哦。
资源推荐
资源详情
资源评论
收起资源包目录
Java仿千千静听音乐播放器源代码 (212个子文件)
CrystalPlayer.class 12KB
Util.class 9KB
CrystalList.class 7KB
MediaListener.class 7KB
VolumeBar.class 5KB
LyricsHunter.class 5KB
ProgressBar.class 5KB
LyricsHunter.class 5KB
ShapeLabel.class 5KB
CrystalLyricsList.class 5KB
TrayIconTest.class 4KB
Muisc.class 4KB
LTextField.class 4KB
TrayIcon.class 4KB
LPasswordField.class 4KB
Core.class 4KB
CrystalSkin.class 4KB
Lyrics.class 4KB
ToolButton.class 4KB
LButton.class 4KB
ListItem.class 4KB
CrystalButton.class 4KB
ParameterManager.class 3KB
SoudPlayer.class 3KB
ImageButton.class 3KB
Lyrics.class 3KB
TrayIcon.class 3KB
CrystalLyrics.class 3KB
MediaAdapter.class 3KB
LyricsItem.class 2KB
Skin.class 2KB
LyricsSelecter.class 2KB
LyricsContent.class 2KB
LyricsContent.class 2KB
CrystalVideo.class 2KB
LyricsWriter.class 2KB
LyricsSelecterModel.class 2KB
RectangleDialog.class 2KB
MuiscListModel.class 2KB
RectangleFrame.class 2KB
LyricsModel.class 2KB
ImagePanel.class 1KB
LyricsContents.class 1KB
LyricsContents.class 1KB
TrayIconEvent.class 1KB
FileChooser.class 1KB
FileChooser$MediaFileFilter.class 1KB
ShapeThread.class 1KB
CrystalPlayer$StatusAdapter.class 1000B
ProgressBarEvent.class 969B
VolumeBarEvent.class 961B
TrayIconTest$2.class 896B
TrayIcon$1.class 847B
ExitAction.class 619B
TrayIconTest$1.class 515B
TrayIconListener.class 268B
SkinListener.class 211B
LyricsDownLoedListener.class 198B
LyricsDownLoedListener.class 198B
ProgressBarListener.class 196B
VolumeBarListener.class 188B
TrayIcon.cpp 12KB
player.module.dep2 26KB
eb.cstop.swing.dep2 22KB
player.user.dep2 21KB
player.lyrics.dep2 9KB
player.core.dep2 8KB
eb.cstop.util.dep2 3KB
eb.cstop.swt.dep2 3KB
player.skin.dep2 2KB
TrayIcon.dll 216KB
TrayIcon.dll 216KB
TrayIcon.dsp 4KB
TrayIcon.dsw 539B
TrayIcon.exp 1KB
icon.gif 617B
TrayIcon.h 649B
CrystalPlayer.ico 3KB
JSpaces-1[1].1.jar 4.19MB
JMF.jar 1.87MB
jaudiotagger.jar 331KB
commons-httpclient.jar 273KB
media reader.jar 188KB
commons-logging-1.1.jar 52KB
commons-codec-1.3.jar 46KB
commons-logging-api-1.1.jar 44KB
commons-logging-adapters-1.1.jar 20KB
CrystalPlayer.java 10KB
Util.java 7KB
CrystalList.java 6KB
MediaListener.java 5KB
TrayIconTest.java 4KB
Muisc.java 4KB
TrayIcon.java 4KB
ProgressBar.java 4KB
TrayIcon.java 4KB
VolumeBar.java 4KB
LTextField.java 4KB
ParameterManager.java 4KB
LButton.java 3KB
共 212 条
- 1
- 2
- 3
资源评论
- 蓝宝石2014-02-20我用的是eclipse编辑软件 不能运行 希望能提供一个能在eclipse上运行的项目
- neo2one2012-12-11貌似可以,但是完全没注释,初学者看着费劲。
- dongjilu202013-01-24完全没注释,初学者看着费劲
雪岢奇
- 粉丝: 309
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功