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

📄 clocklabel.java

📁 java swing 开发代码
💻 JAVA
字号:
// ClockLabel.java// An extension of the JLabel class that listens to events from// a Timer object to update itself with the current date & time.//package	jswing.ch27;import java.util.Date;import java.awt.event.*;import javax.swing.*;public class ClockLabel extends JLabel implements ActionListener {  public ClockLabel() {    super("" + new Date());    Timer t = new Timer(1000, this);    t.start();  }  public void actionPerformed(ActionEvent ae) {    setText((new Date()).toString());  }}

⌨️ 快捷键说明

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