Java仿千千静听音乐播放器源代码

2019-09-02 13:17

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);

- 1 -

private boolean exited = false; 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(\);

- 2 -

int i = 1;

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);

- 3 -

}

}

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;

- 4 -

}

this.setButton();

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();

- 5 -


Java仿千千静听音乐播放器源代码.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:FLUENT udf中文资料ch8

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

马上注册会员

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