📄 test.java.bak
字号:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.text.SimpleDateFormat;
public class Test extends JFrame{
static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");// HH:mm:ss
JTextArea ta;
public Test() {
ta=new JTextArea();
Container con=getContentPane();
setLayout(new BorderLayout());
con.add(ta,BorderLayout.NORTH);
}
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
Test jf=new Test();
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Date date=new Date();
String s=null;
try {
//解析接收到字符串
s=(String)df.format(date);
}
catch (Exception ex) {
}
if(s!=null){
Color tColor=Color.RED;
//jf.ta.getGraphics().setColor(tColor);
jf.ta.append(s);
}
jf.setSize(200,100);
jf.setResizable(false);
jf.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -