資源簡介
java開發的連連看小游戲,框架完整,適合初學者學習!

代碼片段和文件信息
package?kyodai;
import?java.awt.*;
import?javax.swing.*;
/**
?*?title:?LianLianKan
?*?Description:?連連看
?*?Copyright:?Copyright?(c)?2004
?*?Company:?www.wuhantech.com
?*?@author?ZhangJian
?*?@version?1.0
?*/
public?class?ClockAnimate
????extends?JPanel
????implements?Runnable?{
??private?volatile?Thread?thread;
??long?startTime?=?0l;?//開始時間
??long?usedTime?=?0l;?//使用時間
??Color?color?=?new?Color(212?255?200);
??//Color?jfcBlue?=?new?Color(255?255?0);
??//Color?jfcBlue?=?new?Color(55?77?118);
??Font?font48?=?new?Font(“serif“?Font.PLAIN?28);
??java.text.DecimalFormat?df?=?new?java.text.DecimalFormat(“000“);
??java.text.DecimalFormat?df2?=?new?java.text.DecimalFormat(“0“);
??public?ClockAnimate()?{
????this.setMinimumSize(new?Dimension(156?48));
????this.setPreferredSize(new?Dimension(156?48));
??}
??/**
???*?繪制時間
???*?@param?g
???*/
??public?void?paint(Graphics?g)?{
????Graphics2D?g2?=?(Graphics2D)?g;
????Dimension?d?=?getSize();
????g2.setBackground(new?Color(111?146?212));
????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(“Time:“?+?getTime()?16?40);
??}
??/**
???*?取得使用時間格式化后的字符串
???*?@param?time
???*?@return
???*/
??String?getTime()?{
????int?sec?ms;
????long?time;
????time?=?usedTime;
????sec?=?Math.round(time?/?1000);
????time?-=?sec?*?1000;
????ms?=?Math.round(time?/?100);
????return?(df.format(sec)?+?“.“?+?df2.format(ms));
??}
??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();
??????usedTime?=?time?-?startTime;
??????try?{
????????repaint();
????????thread.sleep(100l);
??????}
??????catch?(InterruptedException?ex)?{
??????}
????}
??}
??public?void?stop()?{
????if?(thread?!=?null)?{
??????thread?=?null;
????}
??}
??/**
???*?取得用戶使用的時間
???*?@return
???*/
??public?int?getUsedTime()?{
????return?Math.round(usedTime?/?1000);
??}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2004-12-24?09:59??doc\
?????文件?????????685??2004-11-23?21:27??doc\about.htm
?????文件????????2272??2004-11-24?17:52??doc\help.htm
?????文件????????1265??2004-11-24?00:39??doc\setup.htm
?????目錄???????????0??2004-12-24?09:59??images\
?????文件????????1302??2004-11-15?09:34??images\1.gif
?????文件????????1636??2004-11-15?09:53??images\10.gif
?????文件????????1634??2004-11-15?09:55??images\11.gif
?????文件????????1517??2004-11-15?09:43??images\12.gif
?????文件????????1581??2004-11-15?09:55??images\13.gif
?????文件????????1550??2004-11-15?09:57??images\14.gif
?????文件????????1572??2004-11-15?09:57??images\15.gif
?????文件????????1573??2004-11-15?09:36??images\16.gif
?????文件????????1507??2004-11-15?09:58??images\17.gif
?????文件????????1416??2004-11-15?09:58??images\18.gif
?????文件????????1668??2004-11-15?09:58??images\19.gif
?????文件????????1681??2004-11-15?09:47??images\2.gif
?????文件????????1568??2004-11-15?09:59??images\20.gif
?????文件????????1647??2004-11-15?09:59??images\21.gif
?????文件????????1626??2004-11-15?09:44??images\22.gif
?????文件????????1654??2004-11-15?09:59??images\23.gif
?????文件????????1634??2004-11-15?10:00??images\24.gif
?????文件????????1490??2004-11-15?10:00??images\25.gif
?????文件????????1587??2004-11-15?10:01??images\26.gif
?????文件????????1663??2004-11-15?09:36??images\27.gif
?????文件????????1570??2004-11-15?10:02??images\28.gif
?????文件????????1576??2004-11-15?09:37??images\29.gif
?????文件????????1652??2004-11-15?09:47??images\3.gif
?????文件????????1647??2004-11-15?09:37??images\30.gif
?????文件????????1587??2004-11-15?09:38??images\31.gif
?????文件????????1632??2004-11-15?09:42??images\32.gif
............此處省略52個文件信息
- 上一篇:content.jar
- 下一篇:mybatis-spring-1.3.0.jar
評論
共有 條評論