Boa noite Galera,
Seguinte, estou tentando renderizar um imageIcon, soh que quero faze com cada linha tenha ou seu proprio imageicon,
[code]@Override
public Component getTableCellRendererComponent(JTable tabela, Object valor, boolean isSelected, boolean hasFocus, int row, int col) {
JLabel l = (JLabel) super.getTableCellRendererComponent(tabela, valor, isSelected, hasFocus, row, col);
if(valor.getClass() == Tigre.class) {
l.setIcon(new ImageIcon("gif.gif"));
return this;
}
//demais verificacoes
return this;
}[/code]
esse valor vem do getValueAt da tablemodel q pega os valores em um array.
Object bichos[][] = new Object[7][9];
bichos[0][0] = tigre = new Tigre(6);
bichos[0][2] = new Elefante(8);
bichos[1][1] = new Gato(2);
bichos[2][2] = new Lobo(4);
bichos[4][2] = new Leopardo(5);
bichos[5][1] = new Cao(3);
bichos[6][0] = new Tigre(6);
bichos[6][2] = new Rato(1);
o get valueat…[code]
public Object getValueAt(int row, int col) {
if(bichos[row][col]!=null) {
return bichos[row][col];
}
return 0;
}[/code]
ele retorna em todas as celulas o q deveria retorna soh para a primeira.Alguem tem uma dica?