It would be helpful to see what your TableModel
looks like, as we could give you ideas that would offer minimal changes to your current design. However, one solution would be to design a custom data object that would represent a row in your table, and have your TableModel
use it to supply the correct data for each column, including the image that you currently display.
edit:
basically I have a single column table and DefaultTableModel set up with 2 columns. I would like only the first column of the Model to display.
I would suggest that you create your own TableModel
by extending AbstractTableModel
. For that you just need to implement three methods:
public int getRowCount();
public int getColumnCount();
public Object getValueAt(int row, int column);
You then could provide a backing collection like a List
to hold your row data. Your getRowCount()
could return the size of the list, your getColumnCount()
could return 1
for your picture column. getValueAt()
would then return the picture from the custom data object that I mentioned above.