By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,557 Members | 1,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,557 IT Pros & Developers. It's quick & easy.

Help Me

P: n/a
Hello Everybody,

This might be a dumb question, but I need help. Is there a way to add
and remove rows/columns dynamically at runtime from a JTable.
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
viator wrote:
Hello Everybody,

This might be a dumb question, but I need help. Is there a way to add
and remove rows/columns dynamically at runtime from a JTable.


Not a dumb question at all. Like most Swing components, the JTable uses
a MVC (model-view-controller) philosophy. The rows and columns are
managed by the JTable's model, a class implementing TableModel. By
default, the JTable uses DefaultTableModel. You can extend this class
or AbstractTableModel and gain control over the number of rows, columns
or the data in the table.

E.g., if your uses adds a row, you simply change the values returned
from from TableModel implementation and fire an event to tell the JTable
something has changed.

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.