java swing 启动一个简单的窗体
import javax.swing.*; import java.awt.event.*; public class Demo extends JFrame { public Demo(String title){ this.setTitle(title);//设置窗体标题 this.setBounds(350,350,350,300);//设置窗体尺寸 this.setVisible(true);//显示窗体 this.addWindowListener(new WindowAdapter(){//添加窗体关闭事件 public void windowClosing(WindowEvent ev){ setDefaultCloseOperation(DISPOSE_ON_CLOSE); } }); } public static void main(String[]args){ new Demo("Test"); } }