Validates this container and all of its subcomponents.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.If this Container is not valid, this method invokes the validateTree method and s this Container as valid. Otherwise, no action is performed.
用鼠标一改变窗体的大小,整个窗体的区域都变成了无效,也会重新渲染
因为在添加组件时是不会重绘组件的,新的组件只有当重新绘制的时候才会显示出来
用鼠标改变大小,组件当然就会重新绘制,所以新添加的组件就显示出来了