Difference between validate(), revalidate() and invalidate() in Swing GUI
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Swing components have multiple methods related to updates of screen layout, in particular: validate() invalidate() revalidate() The Java documentation defines these somewhat from a technical perspective, but it's not particularly clear how they are meant to be used. What is the difference between these, and in what circumstances should you use one rather than the others? 回答1: invalidate() marks the container as invalid. Means the content is somehow wrong and must be re-laid out. But it's just a kind of mark/flag. It's possible that multiple