⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clocklabel.java

📁 个人开发的数字助理
💻 JAVA
字号:
package Default;import java.awt.*;import javax.swing.JLabel;import java.util.*;import java.text.*;public class Clocklabel extends JLabel implements Runnable {	private Thread	clockthread	= null;//	----------------------------------------------------------------------------------------------------------------------------------------	public Clocklabel()		{			if (clockthread == null)				{					clockthread = new Thread(this, "clock");					clockthread.start();				}		}//	----------------------------------------------------------------------------------------------------------------------------------------	public void run() {		while (true)			{				Date d = new Date();				SimpleDateFormat sdf = new SimpleDateFormat(						"yyyy年MM月dd日 kk时mm分ss秒 ");// 其中yyyy-MM-dd是你要表示的格式				// 可以任意组合,不限个数和次序;具体表示为:MM-month,dd-day,yyyy-year;kk-hour,mm-minute,ss-second;				String str = sdf.format(d);				//            					// Calendar cal=Calendar.getInstance();				// Date date=cal.getTime();				// DateFormat dateformatter=DateFormat.getTimeInstance();				// this.setText(dateformatter.format(date));				this.setText(str);				try					{						Thread.sleep(1000);					} catch (Exception e)					{					}			}	}//	----------------------------------------------------------------------------------------------------------------------------------------	public Thread getClockthread() {		return clockthread;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -