第一个问题我不知道。
pack()方法会通知容器重新安排所有本容器内的组件,如果你使用了某个组件的setPerfectSize()方法,那么用pack()方法通知容器,容器就会重新安排组件的位置。

解决方案 »

  1.   

    double weightx 
              Specifies how to distribute extra horizontal space. 
     double weighty 
              Specifies how to distribute extra vertical space. 好像是象素为单位.
      

  2.   

    pack()是自动计算窗口的大小吧?
      

  3.   

    应该是象素为单位的
    gridwidth 
              Specifies the number of cells in a row for the component's display area