-> Na importação do swing digitei jTable ao invés de JTable.
Obrigado.
Olá.
Estou começando em JAVA e estou utilizando muitos vídeos para me orientar.
Criei o seguinte código:
private void jTTabelaLinhaSelecionada(jTable tabela){
jTCodigo.setText(String.valueOf(servicos.get(tabela.getSelectedRow()).getId()));
jTDataServico.setText(servicos.get(tabela.getSelectedRow()).getDataservico());
jTValServico.setText(String.valueOf(servicos.get(tabela.getSelectedRow()).getValservico()));
jCTPServico.setSelectedItem(servicos.get(tabela.getSelectedRow()).getTpservico());
jCTPVeiculo.setSelectedItem(servicos.get(tabela.getSelectedRow()).getTpveiculo());
}
Código de pós-inicialização:
jTTabela.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
lsmServico = jTTabela.getSelectionModel();
lsmServico.addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e){
if(! e.getValueIsAdjusting()){
jTTabelaLinhaSelecionada(jTTabela);
}
}
});
Método com erro:
jTTabelaLinhaSelecionada(jTTabela);
Mensagem de erro apresentada:
method jTTabelaLinhaSelecionada in class hco.forms.jTAuto_Mecanica cannote be applied to given types;
required: javax.swing.jTable
found: javax.swing.jTable
reason: actual argument javax.swing.jTable cannot be converted to javax.swing.jTable by method
invocation conversion
O Generated Code pede para criar método jTTabelaLinhaSelecionada(javax.swing.JTable) em
Por favor… quem puder me ajudar ficarei agradecido.
Abraços.