Yes.
You need to use a custom cell renderer. Check out How to use Tables for more details.
You actually have two choices, you could simply set the icon and the text of the cell or you could use the renderers tooltip text instead...
public class IconTextCellRemderer extend DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
setText(...);
setIcon(...);
setToolTipText(...);
return this;
}
}
Of course you need to apply the renderer to the column...
TableColumnModel tcm = table.getColumnModel();
tcm.getColumn(x).setCellRenderer(new IconTextCellRemderer());
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…