- 1、本文档共74页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[计算机软件及应用]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);
private boolean exited = false;
private boolean pressed = false;
public CrystalButton() {
this();
}
public CrystalButton(String text) {
this(text, null);
}
public CrystalButton(String text, ImageIcon icon) {
this(text, icon, );
}
public CrystalButton(String text, ImageIcon icon, String toolTip) {
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);
}
public void setAlpha(float alpha) {
this.alpha = alpha;
this.repaint();
}
public float getAlpha() {
return alpha;
}
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));
int i = 1;
int comparison = 0;
if (exited !pressed)
cs.setColor(exitedBorderColor);
else
cs.setColor(borderColor);
cs.drawRect(0, 0, width - 1, height - 1);
while (i height - 1) {
comparison = (i - 1) * 100 / (height - 3);
if (comparison 36) {
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 !=
您可能关注的文档
- [计算机软件及应用]EXCEL实务操作.ppt
- [计算机软件及应用]excel的使用方法.ppt
- [计算机软件及应用]Exchange2003安装步骤.doc
- [计算机软件及应用]excel讲议1.ppt
- [计算机软件及应用]DEFINITY-all呼叫中心方案.ppt
- [计算机软件及应用]exchange安装图解.doc
- [计算机软件及应用]expand 过程.ppt
- [计算机软件及应用]CorelDRAW 08软件大纲教学课程.ppt
- [计算机软件及应用]Extending Windows Media Library with a Media Parser Plug-in.pdf
- [计算机软件及应用]EZ Drive USB Flash Disk.pdf
文档评论(0)