📄 systemdate.java
字号:
package view.com.systime;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JLabel;
public class SystemDate implements Runnable{
private static JLabel jl;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
public SystemDate(JLabel jl) {
this.jl = jl;
Thread th = new Thread(this);
// th.setDaemon(true);
th.start();
// this.start();
}
public void run() {
while (true) {
this.jl.setText("系统日期:" + sdf.format(new Date()));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -