tags:

views:

31

answers:

1

How would you go about creating a java swing table, which automatically creates a new column whenever a column item is added ?

For example, adding "Id", would intially add a Id column table. adding "title" would add "title" column table.

any examples or library that can handle this already ? Also, how would you also display an image inside the table ?

A: 

For example, adding "Id", would intially add a Id column table.

Check out the addColumn(...) method of the DefaultTableModel.

Also, how would you also display an image inside the table ?

Override the getColumnClass() method of the JTable or the TableModel to return Icon for the appropriate column and the table will use the Icon renderer. Then you add an Icon to the TableModel for that column.

camickr