What is the importance of JTable model.Does all the swing components has model associated with it.
What is the importance of JTable model.Does all the swing components has model associated
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.