I just started learning on making gui on Java. I watched some youtube videos and i realise one of the them uses DefaultTableModel. At first i thought it was to allow access to the function of the table but i realise i can directly
write and get value from the table itself by directly calling the table name.

Need someone to explain what is the point or benefits of using DefaultTableModel?


Tables are split into two main parts - the visible GUI stuff, and the data for the table. This allows you to chose how to store the data any way you like, without affecting the way the GUI display works (and vice-versa). The part that holds the data is called the TableModel.
For simple cases, where there's nothing special about the data storage, you use a DefaultTableModel that does it for you, so you don't have to write any extra code. Similarly, the GUI part of the table has methods to access the data in the TableModel for you, so you don't need to bother with that either unless you have a special requirement.

Oracle's tutorials are an excellent source of info. Maybe not the easiest because they are so comprehensive, but an ideal place to go when a simpler tutorial hasn't answered all your questions, eg

thanks alot!!! will read up on that link. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.