疯狂java


您现在的位置: 疯狂软件 >> 新闻资讯 >> 正文

Java Swing简单框架


 

    import java.awt.*;

  import javax.swing.*;

  public class SimpleFrameTest{

  /**

  * @param args

  */

  public static void main(String[] args) {

  // TODO Auto-generated method stub

  EventQueue.invokeLater(new Runnable()

  {

  public void run()

  {

  SimpleFrame frame = new SimpleFrame();

  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

  frame.setVisible(true);

  }

  });

  }

  }

  class SimpleFrame extends JFrame

  {

  public SimpleFrame()

  {

  setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

  }

  public static final int DEFAULT_WIDTH = 300;

  public static final int DEFAULT_HEIGHT = 200;

  }