📄 timedialog.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 + -