希望不要只说方法,方法我也会调用,我要的是道理,难道大家做项目都不用Swing?客户端也重来不用?难道大家只是图个效果,其中的概念和道理就混过去了?
我希望大家都来讨论,知道一点说一点,就是说错了也不怕啊,我就敢说自己菜鸟一只,向各位请教了!!!

解决方案 »

  1.   

    老大我的jcomponent.revalidate()就是正轨了,你还想怎样。这个方法是sun弥补你遇到情况的举措。
      

  2.   

    楼上老大,我先调用validate();再repaint();同样也无任何问题,我现在不关心方法如何如何调用,我想知道其中的道理,否则不是知其然不知其所以然,比如你可以说一下为什么你调用revalidate();我调用validate();repaint()都行?或则你可以说说窗口在改变大小,最大(小)化时系统的调用等等……洗耳恭听:)
      

  3.   

    I can just give some thought here. Not sure it is right.When a container is up, it will automatically call all component's repaint(), so normally all you need to do is to add components to a container, then call container's owner (a frame or something else) show().However, if the owner is already showing, and you want to add new component to the container, then you need to repaint.