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

📄 timedialog.java

📁 Eclipse编程技术与实例一书的附CD-ROM光盘
💻 JAVA
字号:
package myplugin;

import java.util.Date;

import javax.swing.JDialog;
import javax.swing.JEditorPane;

public class TimeDialog extends JDialog {

	private JEditorPane jEditorPane = null;

	public TimeDialog() {
		initialize();
	}

	// 在TimeDialog上添加JEditorPane,并显示出当前的时间、日期
	private void initialize() {
		this.setContentPane(getJEditorPane());

		this.jEditorPane.setText(new Date().toString());
		this.jEditorPane.setEditable(false); // 不允许编辑

		this.setTitle("时间日期"); // 设定标题
		this.setSize(200, 200); // 设定显示大小

	}

	// 初始化JEditorPane
	private JEditorPane getJEditorPane() {
		if (jEditorPane == null) {
			jEditorPane = new JEditorPane();
		}
		return jEditorPane;
	}
}

⌨️ 快捷键说明

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