I have a Java application which uses JTables to add files for browsing. It contains only 1 column:
DefaultTableModel model = new DefaultTableModel(new String[] {"Name"}, 0);
JTable tracks = new JTable(model){
public boolean isCellEditable(int rowIndex, int collIndex){
return false;
}
};
tracks.addMouseListener(new PopupListener());
tracks.setShowGrid(false);
Adding files to the table is done like this:
for (File file : results){
model.addRow(new Object[] {file});
}
I need to add the actual file, not just its name because I will use it later. However, is it possible that the table shows only the file name (file.getName();) instead of the entire path?