资源简介
java连连看,自己设计java连连看,喜欢的朋友可以下载看看,功能有声音,刷新,提示,炸弹等~~
代码片段和文件信息
package lianliankan;
import java.awt.*;
import javax.swing.*;
public class ClockAnimate extends JPanel
implements Runnable {
private volatile Thread thread;
long startTime = 0l; //�
long restTime = 0l; //ʹ�
Color color = new Color(0 0 0);
//Color jfcBlue = new Color(255 255 0);
//Color jfcBlue = new Color(55 77 118);
Font font48 = new Font(“serif“ Font.PLAIN 20);
java.text.DecimalFormat df = new java.text.DecimalFormat(“000“);
public ClockAnimate() {
this.setMinimumSize(new Dimension(156 48));
this.setPreferredSize(new Dimension(156 48));
}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Dimension d = getSize();
g2.setBackground(new Color(255 255 255));
g2.clearRect(0 0 d.width d.height);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(color);
g2.setFont(font48);
g2.drawString(“剩余时间:“ + getTime() 16 40);
}
String getTime() {
int sec ms;
long time;
time = restTime;
sec = Math.round(time);//算时
time -= sec * 1000;
return (df.format(sec));
}
public void start() {
startTime = System.currentTimeMillis();
thread = new Thread(this);
thread.start();
}
public void run() {
Thread currentThread = Thread.currentThread();
while (thread == currentThread) {
long time = System.currentTimeMillis();
restTime = startTime/1000-time/1000+200; //设置剩余时间
if(restTime==0){
TimeOut frame=new TimeOut();
frame.settitle(“TimeOut“);
frame.setSize(620393);
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
int screenWidth = screenSize.width;
int screenHeight =screenSize.height;
int x=(screenWidth-frame.getWidth())/2;
int y=(screenHeight-frame.getHeight())/2;
frame.setLocation(x+78y+21);
frame.setVisible(true);
break;
}
try {
repaint();
thread.sleep(100l);
}
catch (InterruptedException ex) {
}
}
}
//线程停止
public void stop() {
if (thread != null) {
thread = null;
}
}
public int getUsedTime() {
return Math.round(restTime);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1299 2008-11-18 22:34 lianliankan\build\classes\doc\help.htm
文件 1654 2008-11-18 21:49 lianliankan\build\classes\images\1.gif
文件 1601 2008-11-18 21:49 lianliankan\build\classes\images\10.gif
文件 1770 2008-11-18 21:49 lianliankan\build\classes\images\11.gif
文件 1945 2008-11-18 21:49 lianliankan\build\classes\images\12.gif
文件 1921 2008-11-18 21:49 lianliankan\build\classes\images\13.gif
文件 1720 2008-11-18 21:49 lianliankan\build\classes\images\14.gif
文件 1779 2008-11-18 21:49 lianliankan\build\classes\images\15.gif
文件 1610 2008-11-18 21:49 lianliankan\build\classes\images\16.gif
文件 1832 2008-11-18 21:49 lianliankan\build\classes\images\17.gif
文件 1555 2008-11-18 21:49 lianliankan\build\classes\images\18.gif
文件 1576 2008-11-18 21:49 lianliankan\build\classes\images\19.gif
文件 1619 2008-11-18 21:49 lianliankan\build\classes\images\2.gif
文件 1880 2008-11-18 21:49 lianliankan\build\classes\images\20.gif
文件 1463 2008-11-18 21:49 lianliankan\build\classes\images\21.gif
文件 1705 2008-11-18 21:49 lianliankan\build\classes\images\22.gif
文件 999 2008-11-18 21:49 lianliankan\build\classes\images\23.gif
文件 1847 2008-11-18 21:49 lianliankan\build\classes\images\24.gif
文件 1600 2008-11-18 21:49 lianliankan\build\classes\images\25.gif
文件 1324 2008-11-18 21:49 lianliankan\build\classes\images\26.gif
文件 1583 2008-11-18 21:49 lianliankan\build\classes\images\27.gif
文件 1565 2008-11-18 21:49 lianliankan\build\classes\images\29.gif
文件 1449 2008-11-18 21:49 lianliankan\build\classes\images\30.gif
文件 1429 2008-11-18 21:49 lianliankan\build\classes\images\32.gif
文件 1676 2008-11-18 21:49 lianliankan\build\classes\images\34.gif
文件 1631 2008-11-18 21:49 lianliankan\build\classes\images\35.gif
文件 1514 2008-11-18 21:49 lianliankan\build\classes\images\36.gif
文件 2048 2008-11-18 21:49 lianliankan\build\classes\images\37.gif
文件 1676 2008-11-18 21:49 lianliankan\build\classes\images\38.gif
文件 1653 2008-11-18 21:49 lianliankan\build\classes\images\39.gif
............此处省略269个文件信息
评论
共有 条评论