PaintComponent() 和 PaintComponents() 有什么不同?
我想知道 PaintComponent() 和 PaintComponents() 之间有什么不同?
当我使用 PaintComponent 时,它显示了我们想要的所有内容,但 PaintComponents 没有做任何事情!
I want to know what is different between paintcomponent() and paintcomponents()?
when i use from paintcomponent it shows every thing that we want,but paintcomponents didn't do any thing!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从
java.awt.Container.paintComponents
看起来它(间接)调用paint (经过一些其他处理后)在它的子组件上,你覆盖它的唯一原因是如果你想用它做一些时髦的事情。一般来说,除非您真的知道自己在做什么,否则您可能不应该覆盖它,而应该只覆盖适当控件上的paintComponent
。From a quick browser of the source of
java.awt.Container.paintComponents
it seems like it (indirectly) calls paint (after some other processing) on it's child components, and the only reason you'd override it is if you want to do something funky with it. Generally unless you really know what you're doing you probably shouldn't override it and instead should just overridepaintComponent
on the appropriate control.