Pessoal, boa tarde.
Gostaria de saber como posso implementar um método que retorne a linha selecionada em uma JTable.
Abs.
Obter a linha selecionada em um JTable
M
3 Respostas
Eo obtenho dessa forma:
//no evento do botão
int linha = getTabela().getSelectedRow();
Object item = null;
item = getTabela().getModel().getValueAt(linha, 0);
não precisa implementar, ele já existe:
int getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected.
[edit]ops, por 3 segundos… hehehe
o do Pedrosa está mais completo :roll:
M
dudaskank, muito obrigado!!
Criado 29 de janeiro de 2007
Ultima resposta 29 de jan. de 2007
Respostas 3
Participantes 3