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.