Java仿千千静听音乐播放器源代码
更新时间:2023-06-09 09:33:01 阅读量: 实用文档 文档下载
Java仿千千静听音乐播放器源代码 自己收集的。
JAVA仿千千静听音乐播放器源代码
CrystalButton.java
package eb.cstop.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.ImageIcon;
import javax.swing.JButton;
public class CrystalButton extends JButton implements MouseListener {
private float alpha = 1.0f; private Color borderColor = new Color(0x00, 0x00, 0x00); private Color exitedBorderColor = new Color(0x33, 0x33, 0x33);
Java仿千千静听音乐播放器源代码 自己收集的。
private boolean pressed = false; public CrystalButton() { } public CrystalButton(String text) { } public CrystalButton(String text, ImageIcon icon) { } public CrystalButton(String text, ImageIcon icon, String toolTip) { } public void setAlpha(float alpha) { } public float getAlpha() { } public void paintBorder(Graphics g) { } public void paintComponent(Graphics g) { Graphics2D cs = (Graphics2D) g; int width = this.getSize().width; int height = this.getSize().height; cs.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); return alpha; this.alpha = alpha; this.repaint(); this.addMouseListener(this); this.setText(text); if (icon != null) this.setIcon(icon); this.setContentAreaFilled(false); this.setFont(new Font("宋体", 0, 12)); this.setForeground(Color.white); this.setToolTipText(toolTip); this(text, icon, ""); this(text, null); this("");
Java仿千千静听音乐播放器源代码 自己收集的。
int comparison = 0; if (exited && !pressed) cs.setColor(exitedBorderColor); cs.setColor(borderColor); else cs.drawRect(0, 0, width - 1, height - 1); while (i < height - 1) { } cs.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f)); super.paintComponent(g); cs.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); comparison = (i - 1) * 100 / (height - 3); if (comparison < 36) { } i++; if (exited && !pressed) cs.setColor(new Color(255 - (comparison + comparison * 2), 255 - (comparison + comparison * 2), 255 - (comparison + comparison * 2))); else cs.setColor(new Color(235 - (comparison + comparison * 2), 235 - (comparison + comparison * 2), 235 - (comparison + comparison * 2))); cs.drawLine(1, i, width - 2, i); if (i != 1) { } if (exited && !pressed) cs.setColor(new Color(comparison - 16, comparison - 16, comparison - 16)); if (exited && !pressed) cs.setColor(new Color(204 - comparison * 2, 204 - comparison * 2, 204 - comparison * 2)); else cs.setColor(new Color(184 - comparison * 2, 184 - comparison * 2, 184 - comparison * 2)); cs.drawLine(2, i, width - 3, i); } else { else cs.setColor(new Color(comparison - 36, comparison - 36, comparison - 36)); cs.drawLine(1, i, width - 2, i);
Java仿千千静听音乐播放器源代码 自己收集的。
} public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } pressed = false; this.repaint(); exited = true; this.repaint(); exited = false; this.repaint(); pressed = true; this.repaint();
LButton.java
package eb.cstop.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class LButton extends JButton implements MouseListener {
public LButton(String text) { super(text); public LButton() { } this.setButton(); private final Font font = new Font("宋体", 0, 12); private boolean mouseOn = false; private boolean mouseDown = false;
Java仿千千静听音乐播放器源代码 自己收集的。
} public LButton(ImageIcon icon) { } public LButton(String text, ImageIcon icon) { } private void setButton() { } public void paintBorder(Graphics g) { this.setContentAreaFilled(false); g.setColor(new Color(255, 255, 255)); g.fillRect(3, 3, this.getSize().width - 5, this.getSize().height - 5); if (!this.mouseDown) { if (!this.mouseOn) { } g.drawLine(3, 2, this.getSize().width - 3, 2);// TopLine g.drawLine(3, this.getSize().height - 3, this.getSize().width - 3, this.getSize().height - 3);// BottomLine g.drawLine(2, 3, 2, this.getSize().height - 4);// LeftLine g.drawLine(this.getSize().width - 2, 3, this.getSize().width - 2, this.getSize().height - 4);// RightLine int height = this.getSize().height - 5; int row = 3; while (row <= height) { int now = (row * 100) / height; if (now <= 35) { if (!mouseOn) { g.setColor(new Color(245 - now, 245 - now, 245 - now)); } else { g.setColor(new Color(160, 160, 160)); g.setColor(new Color(180, 180, 180)); } else { this.setFont(font); this.addMouseListener(this); this.setForeground(new Color(0, 70, 150)); super(text); this.setIcon(icon); this.setButton(); this.setIcon(icon); this.setButton();
Java仿千千静听音乐播放器源代码 自己收集的。
} } } } } g.drawLine(4, row, this.getSize().width - 4, row); if (!mouseOn) { } g.drawLine(4, row, this.getSize().width - 4, row); g.setColor(new Color(140 + now, 140 + now, 140 + now)); g.setColor(new Color(150 + now, 150 + now, 150 + now)); } else { } else { row++; } else { g.setColor(new Color(140, 140, 140)); g.drawLine(3, 2, this.getSize().width - 3, 2); g.drawLine(3, this.getSize().height - 3, this.getSize().width - 3, this.getSize().height - 3); g.drawLine(2, 3, 2, this.getSize().height - 4); g.drawLine(this.getSize().width - 2, 3, this.getSize().width - 2, this.getSize().height - 4); int height = this.getSize().height - 5; int row = 3; while (row <= height) { } int now = (row * 100) / height; if (now <= 35) { } row++; g.setColor(new Color(210 - now, 210 - now, 210 - now)); g.drawLine(4, row, this.getSize().width - 4, row); g.setColor(new Color(110 + now, 110 + now, 110 + now)); g.drawLine(4, row, this.getSize().width - 4, row); } else { super.paintComponent(g); public void paintComponent(Graphics g) { } public void mouseClicked(MouseEvent e) { } super.paintComponent(g);
Java仿千千静听音乐播放器源代码 自己收集的。
} public void mouseReleased(MouseEvent e) { } this.mouseDown = false; this.repaint(); public void mousePressed(MouseEvent e) { } this.mouseDown = true; this.repaint(); public void mouseExited(MouseEvent e) { } this.mouseOn = false; this.setForeground(new Color(0, 70, 150)); this.repaint(); public void mouseEntered(MouseEvent e) { } this.mouseOn = true; this.setForeground(new Color(50, 130, 210)); this.repaint();
LPasswordField.java
package eb.cstop.swing;
import javax.swing.JPasswordField;
import java.awt.event.FocusListener;
import java.awt.event.FocusEvent;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
import java.awt.Color;
import java.awt.event.MouseListener;
import javax.swing.JPopupMenu;
import javax.swing.JMenuItem;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.ActionEvent;
public class LPasswordField extends JPasswordField implements ActionListener,
FocusListener, KeyListener, MouseListener { private JPopupMenu popup = new JPopupMenu();
Java仿千千静听音乐播放器源代码 自己收集的。
private JMenuItem paste = new JMenuItem(" 粘贴 "); private JMenuItem selectAll = new JMenuItem(" 全选 "); private JMenuItem delete = new JMenuItem(" 删除 ");
private Font font = new Font("宋体", 0, 12);
/**
* 构造函数<br>
*/
public LPasswordField() {
this("");
}
/**
* 构造函数<br>
* column - 占用列长度<br>
*/
public LPasswordField(int column) {
this(column, "");
}
/**
* 构造函数<br>
* column - 占用列长度<br>
* text - 初始本文
*/
public LPasswordField(int column, String text) {
this(text);
this.setColumns(column);
}
/**
* 构造函数<br>
* text - 初始本文
*/
public LPasswordField(String text) {
this.setText(text);
this.addFocusListener(this);
this.addKeyListener(this);
this.addMouseListener(this);
paste.setFont(font);
selectAll.setFont(font);
delete.setFont(font);
paste.addActionListener(this);
selectAll.addActionListener(this);
Java仿千千静听音乐播放器源代码 自己收集的。
} popup.add(paste); popup.add(delete); popup.addSeparator(); popup.add(selectAll); this.setSelectionColor(new Color(0, 80, 140)); this.setSelectedTextColor(Color.white); public void focusGained(FocusEvent e) { } public void focusLost(FocusEvent e) { } public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } public void actionPerformed(ActionEvent e) { } public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { this.requestFocus(); if (this.getPassword().length < 1) { selectAll.setEnabled(false); delete.setEnabled(false); Object source = e.getSource(); if (source == paste) this.paste(); this.selectAll(); this.replaceSelection(""); else if (source == selectAll) else if (source == delete) if (e.getKeyCode() == KeyEvent.VK_ENTER) { } this.transferFocus(); this.selectAll();
Java仿千千静听音乐播放器源代码 自己收集的。
} } } } popup.show(this, e.getX(), e.getY()); selectAll.setEnabled(true); if (this.getSelectedText() != null) delete.setEnabled(true); delete.setEnabled(false); else public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { }
LTextField.java
package eb.cstop.swing;
import javax.swing.JTextField;
import java.awt.event.FocusListener;
import java.awt.event.FocusEvent;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
import java.awt.Color;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.Font;
public class LTextField extends JTextField implements MouseListener,
FocusListener, KeyListener, ActionListener { private JPopupMenu popup = new JPopupMenu(); private JMenuItem copy = new JMenuItem(" 复制 ");
Java仿千千静听音乐播放器源代码 自己收集的。
private JMenuItem cut = new JMenuItem(" 剪切 "); private JMenuItem paste = new JMenuItem(" 粘贴 "); private JMenuItem selectAll = new JMenuItem(" 全选 "); private JMenuItem delete = new JMenuItem(" 删除 "); private Font font = new Font("宋体", 0, 12); public LTextField() { } public LTextField(int column) { } public LTextField(int column, String text) { } public LTextField(String text) { } public void focusGained(FocusEvent e) { this.setText(text); this.addFocusListener(this); this.addKeyListener(this); this.setSelectionColor(new Color(0, 80, 140)); this.setSelectedTextColor(Color.white); this.addMouseListener(this); copy.setFont(font); cut.setFont(font); paste.setFont(font); selectAll.setFont(font); delete.setFont(font); copy.addActionListener(this); cut.addActionListener(this); paste.addActionListener(this); selectAll.addActionListener(this); delete.addActionListener(this); popup.add(cut); popup.add(copy); popup.add(paste); popup.add(delete); popup.addSeparator(); popup.add(selectAll); this(text); this.setColumns(column); this(column, ""); this("");
Java仿千千静听音乐播放器源代码 自己收集的。
} public void focusLost(FocusEvent e) { } public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } public void actionPerformed(ActionEvent e) { } public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { this.requestFocus(); if (this.getText().length() < 1) { copy.setEnabled(false); cut.setEnabled(false); selectAll.setEnabled(false); delete.setEnabled(false); copy.setEnabled(true); cut.setEnabled(true); selectAll.setEnabled(true); Object source = e.getSource(); if (source == cut) this.cut(); this.copy(); this.paste(); this.selectAll(); this.replaceSelection(""); else if (source == copy) else if (source == paste) else if (source == selectAll) else if (source == delete) if (e.getKeyCode() == KeyEvent.VK_ENTER) { } this.transferFocus(); } else {
Java仿千千静听音乐播放器源代码 自己收集的。
} } } } delete.setEnabled(true); delete.setEnabled(false); else popup.show(this, e.getX(), e.getY()); public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { }
ProgressBar.java
package eb.cstop.swing;
import javax.swing.JLabel;
import java.awt.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;
public class ProgressBar extends JLabel implements MouseListener,
MouseMotionListener, MouseWheelListener { private int value = 0; private int minLimit = 0; private int maxLimit = 100; private float alpha = 0.7f; private Color border = new Color(0, 0, 0); private Color color = new Color(250, 160, 0); private ArrayList changeListener = new ArrayList(); private ProgressBarEvent event = new ProgressBarEvent();
Java仿千千静听音乐播放器源代码 自己收集的。
public int getMaxLimit() { public void setMaxLimit(int value) { } if (value > 0) maxLimit = value; maxLimit = 100; else public int getMinLimt() { } return minLimit; public void setMinLimt(int value) { } if (value > 0) minLimit = value; minLimit = 0; else public boolean removeProgressBarListener(ProgressBarListener listener) { } return changeListener.remove(listener); public void addProgressBarListener(ProgressBarListener listener) { } changeListener.add(listener); public float getAlpha() { } return alpha; public void setAlpha(float alpha) { } this.alpha = alpha; this.repaint(); public ProgressBar() { } this.setPreferredSize(new Dimension(-1, 5)); this.addMouseListener(this); this.addMouseMotionListener(this); this.addMouseWheelListener(this);
Java仿千千静听音乐播放器源代码 自己收集的。
} public void setValueForChange(int value) { } public void setValue(int value) { } public int getValue() { } public void setBorderColor(Color border) { return value; if (value == this.value) return; return; return; this.value = value; value = 0; if (value < minLimit) else if (value > maxLimit) if (value >= minLimit) else this.repaint(); ProgressBarListener listener = null; event.setValue(value); event.setComparison((int) (((float) value / maxLimit) * 100.0f)); for (int i = 0; i < changeListener.size(); i++) { } listener = (ProgressBarListener) changeListener.get(i); event.setSource(listener); listener.valueChanged(event); if (value == this.value) return; return; return; this.value = value; value = 0; if (value < minLimit) else if (value > maxLimit) if (value >= minLimit) else this.repaint();
Java仿千千静听音乐播放器源代码 自己收集的。
} this.repaint(); public Color getBorderColor() { } public void setColor(Color color) { } public Color getColor() { } public void paintBorder(Graphics g) { } public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { Graphics2D cs = (Graphics2D) g; int width = this.getSize().width; int valueWidth = (int) (((float) value / maxLimit) * (float) width); cs.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); cs.setColor(color); for (int i = 1; i < valueWidth - 1; i++) { } cs.setColor(border); cs.drawRect(0, 0, width - 1, 4); if (i % 2 == 0) { } cs.drawLine(i, 1, i, 1); cs.drawLine(i, 3, i, 3); return color; this.color = color; this.repaint(); return border;
Java仿千千静听音乐播放器源代码 自己收集的。
} } if (e.getButton() == MouseEvent.BUTTON1) { } int comparison = (int) (((float) e.getX() / (this.getSize().width - this .setValue((int) (((float) comparison / 100) * (float) 2)) * (float) 100); maxLimit)); public void mouseReleased(MouseEvent e) { } public void mouseDragged(MouseEvent e) { } public void mouseMoved(MouseEvent e) { } public void mouseWheelMoved(MouseWheelEvent e) { } if (e.getUnitsToScroll() > 0) this.setValue(value - 2); this.setValue(value + 2); else int comparison = (int) (((float) e.getX() / (this.getSize().width - 2)) this.setValue((int) (((float) comparison / 100) * (float) maxLimit)); * (float) 100);
ProgressBarEvent.java
package eb.cstop.swing;
public class ProgressBarEvent {
public int getValue() { } return value; protected void setValue(int value) { } this.value = value; private Object source; private int comparison; private int value;
Java仿千千静听音乐播放器源代码 自己收集的。
}public Object getSource() { return source; } protected void setSource(Object source) { } this.source = source; public int getComparison() { } return comparison; protected void setComparison(int comparison) { } parison = comparison;
ProgressBarListener.java
package eb.cstop.swing;
public interface ProgressBarListener {
}public void valueChanged(ProgressBarEvent e);
RectangleDialog.java
package eb.cstop.swing;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JDialog;
import java.awt.Frame;
public class RectangleDialog extends JDialog implements MouseListener,
public RectangleDialog() { } this(null); private int beForX = 0; private int beForY = 0; MouseMotionListener {
Java仿千千静听音乐播放器源代码 自己收集的。
} public void mouseMoved(MouseEvent e) { } public void mouseDragged(MouseEvent e) { } this.setLocation(this.getLocation().x + e.getX() - beForX, this .getLocation().y + e.getY() - beForY); public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } beForX = e.getX(); beForY = e.getY(); public void mouseExited(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public RectangleDialog(Frame frame) { } super(frame); this.setUndecorated(true); this.addMouseListener(this); this.addMouseMotionListener(this);
RectangleFrame.java
package eb.cstop.swing;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JFrame;
Java仿千千静听音乐播放器源代码 自己收集的。
public class RectangleFrame extends JFrame implements MouseListener,
} public void mouseMoved(MouseEvent e) { } public void mouseDragged(MouseEvent e) { } this.setLocation(this.getLocation().x + e.getX() - beForX, this .getLocation().y + e.getY() - beForY); public void mouseReleased(MouseEvent e) { } public void mousePressed(MouseEvent e) { } beForX = e.getX(); beForY = e.getY(); public void mouseExited(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public RectangleFrame() { } this.setUndecorated(true); this.addMouseListener(this); this.addMouseMotionListener(this); protected int beForX = 0; protected int beForY = 0; MouseMotionListener {
SoudPlayer.java
package eb.cstop.swing;
import java.io.*;
import javax.sound.sampled.AudioInputStream;
Java仿千千静听音乐播放器源代码 自己收集的。
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.LineUnavailableException;
public class SoudPlayer extends Thread {
public void run() { try { line = (SourceDataLine) AudioSystem.getLine(info); line.open(streamInput.getFormat()); line.start(); private void newObject() { } audioFormat = streamInput.getFormat(); info = new (SourceDataLine.class, audioFormat, 2048); start(); public SoudPlayer(File file) { } try { } streamInput = AudioSystem.getAudioInputStream(file); newObject(); e.printStackTrace(); return; public SoudPlayer(String path) { } File file = new File(path); try { } streamInput = AudioSystem.getAudioInputStreamnewObject(); e.printStackTrace(); return; AudioFormat audioFormat; AudioInputStream streamInput; SourceDataLine line; info; } catch (Exception e) { } catch (Exception e) {
正在阅读:
Java仿千千静听音乐播放器源代码06-09
微机原理 补充作业ch810-27
财经应用文写作05-08
宁夏回族自治区区情02-20
2016-2022年中国射频连接器行业市场运营态势及投资前景预测报告05-25
最高额质押合同(适用于额度合同)04-05
工装模具管理制度12-14
部编新版三年级语文上1-4单元所有词语表词语汇总带解释03-13
基于51单片机煤气报警器毕业论文07-03
- 教学能力大赛决赛获奖-教学实施报告-(完整图文版)
- 互联网+数据中心行业分析报告
- 2017上海杨浦区高三一模数学试题及答案
- 招商部差旅接待管理制度(4-25)
- 学生游玩安全注意事项
- 学生信息管理系统(文档模板供参考)
- 叉车门架有限元分析及系统设计
- 2014帮助残疾人志愿者服务情况记录
- 叶绿体中色素的提取和分离实验
- 中国食物成分表2020年最新权威完整改进版
- 推动国土资源领域生态文明建设
- 给水管道冲洗和消毒记录
- 计算机软件专业自我评价
- 高中数学必修1-5知识点归纳
- 2018-2022年中国第五代移动通信技术(5G)产业深度分析及发展前景研究报告发展趋势(目录)
- 生产车间巡查制度
- 2018版中国光热发电行业深度研究报告目录
- (通用)2019年中考数学总复习 第一章 第四节 数的开方与二次根式课件
- 2017_2018学年高中语文第二单元第4课说数课件粤教版
- 上市新药Lumateperone(卢美哌隆)合成检索总结报告
- 静听
- 千千
- 源代码
- 播放器
- 音乐
- Java
- 甘肃省兰州一中2011届高三文综实战演练(三)
- 《中学教育心理学》第十一章__心理健康教育
- 2015年注会《财管》第22章
- 成本会计 04第四章 生产费用在完工产品和在产品之间分配和归集
- 安徽省淮南市第二中学2015-2016学年高二历史下学期第一次教学检测试题
- 2019年《动物防疫法》知识竞赛试题库及答案(完整版)
- 实验小学20xx——20xx学年第二学期班主任工作计划--一年级(4)班班主任工作计划标准范本
- 2014-2015北京房山初三化学期末试卷
- 电气工程及其自动化职业生涯规划
- 室内环境空气质量监测项目2005720111254843
- 大学生寒假到口腔医院的社会实践报告
- 博耳电力云服务强势着陆 拓千亿变配电设备运维托管市场
- oracle 11g RAC 的基本概念
- 谈如何做好保安队伍建设
- 监理工程师考试公路工程经济模拟试题三
- 浅谈音乐欣赏中感情体验的基本要求
- 郴州水塘治理方案
- 期末复习提高练习6相对运动
- 盘点中美大学教育体制的区别
- 家庭藏书集锦目录