JFrame來創(chuàng)建程序的主框架窗口
/**?* @(#)TestSwing.java
?*
?* TestSwing application
?*
?* @author
?* @version 1.00 2007/1/21
?*/
?import javax.swing.*;
public class TestSwing extends JFrame
{
??? public TestSwing()
??? {
??? ?this.getContentPane().add(new JButton("hello"),"South");
??? ?this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
??? }
??? public static void main(String[] args)
??? {
??? ?
??? ?// TODO, add your application code
??? ?System.out.println("Hello World!");
??? ?TestSwing mainFrame=new TestSwing();
??? ?mainFrame.setTitle("TestSwing");
??? ?mainFrame.setBounds(300,200,400,400);
??? ?mainFrame.setVisible(true);
??? }
}
posted on 2007-01-21 21:22 大頭劍客 閱讀(216) 評論(0) 編輯 收藏 所屬分類: 學習筆記