现在安卓手机可以java编程了,之前测试了控制台编程是OK的,想测试下gui编程,然后想找个简单的示例测试下都半天找不到,后来自己删删改改弄了一个最简单的,记录一下好以后用:
import java.awt.*
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Application {
public static void main(String[] args) {
Frame frame = new Frame("非44");
Label label = new Label("ee非");
frame.add(label);
// 设置窗口大小
frame.setSize(new Dimension(100, 100));
// 点击窗口关闭按钮退出整个程序
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
// 窗口居中
frame.setLocationRelativeTo(null);
// 显示窗口
frame.setVisible(true);
}
}
标签:java,frame,awt,程序,new,import,public From: https://www.cnblogs.com/silentdoer/p/16888168.html