Não consigo resolver o seguinte:
Tenho uma JTable com um JLabel, que tem uma ImageIcon.
Meu renderer é esse:
public class CellRendererJLabel extends JLabel implements TableCellRenderer {
sistema.Controle ca = null;
// This method is called each time a cell in a column
// using this renderer needs to be rendered.
public void setControle(sistema.Controle c){
ca = c;
}
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
// 'value' is value contained in the cell located at
// (rowIndex, vColIndex)
Object[] ob = (Object[])value;
String tipo = (String)ob[0];
String icone = (String)ob[1];
final String acaoControle = (String)ob[2];
final Integer id = (Integer)ob[3];
setIcon(comuns.MetodosPadrao.getIcon(icone));
if(isSelected){
System.out.println("Clicou..");
ca.TabelaChama(acaoControle, id);
}
addMouseListener(
new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
System.out.println("Clicou..");
ca.TabelaChama(acaoControle, id);
}
});
return this;
}
}
Já tentei esse mouselistener, já tentei de tudo, não consigo criar um evento para o jlabel…
alguem tem alguma ideia?