把setVisible(true)改成show()看看。
我正在装jdk,所以没试。

解决方案 »

  1.   

    加上下面两句:
    this.validate();
    this.repaint();
      

  2.   

    里面用JButton(Swing),外面用Frame(awt),第一次看见有人这么用.
    改成JFrame好了
      

  3.   


    setVisible(true);
    放到最后
      

  4.   

    as stated by beyond_xiruo, place the "setVisible(true)" in the end.setVisible(true) will call the function of paint. As you place it in the beginning, the uncompleted window will be painted.The window will only be completely correctly painted once your operation invokes the method of repaint() after the first paint() operation. Here, it's the resizing action.