What is the importance of JTable model.Does all the swing components has model associated wit开发者_Python百科h it.
Swing uses the Model-View-controller design pattern. As such, most components provided with Swing have indeed an associated model (not all of them, though).
This allows you to separate the rendering part from the data part. I would recommend you to use your own model for JTable, especially if you are manipulating and/or changing data from it.
However, if you don't have such need, and your JTable is only something you use once, in a small corner of your program, with fixed datas, you can also manipulate data directly from the JTable, neglecting the MVC pattern. A JTable created without specifying a model will create its own model, and the JTable class provides methods to manipulate the data directly, for such cases.
please have a look at MVC design pattern:
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
and yes, most of the java swing components have models, see:
http://java.sun.com/docs/books/tutorial/uiswing/components/model.html
精彩评论