fack()是Window类的方法:
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.validate()是Component、Container类的方法:
The validate method is used to cause a container to lay out its subcomponents again. It should be invoked when this container's subcomponents are modified (added to or removed from the container, or layout-related information
changed) after the container has been displayed.
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.validate()是Component、Container类的方法:
The validate method is used to cause a container to lay out its subcomponents again. It should be invoked when this container's subcomponents are modified (added to or removed from the container, or layout-related information
changed) after the container has been displayed.
pack()方法是根據它所容納的組件計算它的最合適的大小﹐然後變到這個大小。它的作用是根據容器上的組件的最佳大小將容器調整到可能的最小.
寫的很拗口﹐不過你試一下就知道了