Why can't I validate a JComponent?

后端 未结 3 916
执念已碎
执念已碎 2021-01-21 20:37

From JavaDoc:

public void validate()

Validates this container and all of its subcomponents. Validating a container means laying out its s

3条回答
  •  面向向阳花
    2021-01-21 21:06

    The Javadoc for java.awt.Component.isValid() states:

    A component is valid when it is correctly sized and positioned within its parent container and all its children are also valid.

    In short, you can't validate the component until it has been added to a container.

提交回复
热议问题