Remove Swing Component Using Validate or Revalidate

后端 未结 4 854
醉话见心
醉话见心 2020-12-10 15:32

Whenever I remove and add swing components from say JPanel, shall I perform call on validate or revalidate?

4条回答
  •  渐次进展
    2020-12-10 16:18

    revalidate() would be better. revalidate() marks all the container upto the top level as not proper or not valid. Then it calls validate() on the top level. The validate() method of the parent checks if at least one of its immediate children is signaled invalid or improper. it calls validate of the parent. so calling revalidate() automatically means calling validate().

提交回复
热议问题