解决方案 »

  1.   


    import javax.swing.JButton;
    import javax.swing.JFrame;public class Test extends JFrame{
    private static final long serialVersionUID = -6918033826886164234L;
    public Test() throws HeadlessException {
    super();
    this.getContentPane().add(new JButton("测试"));
    this.setBounds(100, 100, 100, 100);
    }


    public static void main(String[] args) {
    new Test().setVisible(true);
    }
    }
    代码如上