Como eu faço um evento mouseClicked para uma Jtable ???
do mesmo jeito q vc faz com botões mas adiciona o listener na Jtable ao inves do botão…
Não é tão simples.
Você deve adicionar um listSelectionListener, no listSelectionModel do JTable:
seuTable.getListSelectionModel().addListenerSelectionListener(
new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
if (evt.getValueIsAdjusting())
return;
int selected = seuTable.getSelectedIndex();
//Seu código aqui
}
});
Para seleção múltipla, use o getSelectedIndices() no lugar do getSelectedIndex().