1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
String[] columns = {
"la colone" "réference", "prix", "Designation_article"};
model = new DefaultTableModel(columns, 0);
model.addRow(new String[] {"", "", ""});
model.addRow(new String[] {"", "", ""});
t = new JTable(model) {
public TableCellRenderer getCellRenderer(int row, int column)
{
return renderer;
}
};
class CellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
ImageIcon fléche ;
JLabel l = new JLabel();
fléche =new ImageIcon("C:\\1.JPG");
l.setIcon(fléche);
final Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if(isSelected)
{
aucune idée sur affichage icone sur la premiere colone si je click sur ligne
}
return component;
}
} |
Partager