Is it possible for a JTable to have static rows and dynamically inserted columns (i.e. instead of inserting rows, to insert columns), as presented below?
DefaultTableModel model = new DefaultTableModel(String[], String[][]);
String rows[] = {"row1","row2"};
String columns[][] = {{"A","100"},{"B","200"},{"C","300"}};
DefaultTableModel model = new DefaultTableModel(rows,columns);
JTable table = new JTable(model);
Yes, update your TableModel and fireTableStructureChanged(). Naturally, editing your question to include an sscce would help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With