Posted on 2009-05-02 01:18
沙漠中的魚 閱讀(576)
評論(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.