package test;
import java.awt.*;
import javax.swing.*;
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Helloworld1 window = new Helloworld1();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Helloworld1() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame("Helloworld");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
}
}
本文介绍了一个使用 Java Swing 构建简单 GUI 应用的示例,通过创建 JFrame 对象并设置其基本属性来展示如何快速搭建窗口界面。
1488

被折叠的 条评论
为什么被折叠?



