Posted on 2009-05-02 01:18
沙漠中的鱼 阅读(567)
评论(0) 编辑 收藏 所属分类:
Java
问题:在找资料的时候看见JTabel用了setModel方法后会加上一个revalidate方法,
可我删了这个方法并没见有什么不同,请指点!
回答一:如果在application上有哪个component由于事件的触发而发生变化(比如,形状)的话,这个方法就是用来更新当前程序的界面用的,就相当于重画一下界面
回答二:The original author comments, very clear:
I added a revalidate to JTable in the case that the table structure
changes (columns/rows added/removed). This is necessary, since such an
operation changes the size parameters of the JTable. It makes JTable
behave more nicely in JScrollPane in an app I have here.