Boa noite, estou APRENDENDO OO, e gostaria de saber como faço pra listar dados em uma table, porém estou com dificuldades em fazer a busca dos dados:
private void preencherTableClientes() {
DefaultTableModel modelo = new DefaultTableModel();
String[] colunasDaTabela = new String[]{"CPF", "Nome", "Telefone", "Veículos"};
modelo.setColumnIdentifiers(colunasDaTabela);
for (Cliente c : this.cli) {
Object[] linhas = {c.getCpfCliente().trim(), c.getNome().trim(), c.getTelefoneCliente().trim(), c.getVeiculos().g}//
//Ao meu ver, deveria poder fazer a busca de getVeiculos().getPlaca()(atributo da minha classe basica de veiculos)
//MÉTODO NÃO ESTÁ COMPLETO!!
}
Minha classe básica de Cliente:
public class Cliente {
private ArrayList<Veiculo> veiculos;
private String cpfCliente;
private String nome;
private String telefoneCliente;
public Cliente() {
this.veiculos = new ArrayList<>();
}
public ArrayList<Veiculo> getVeiculos() {
return veiculos;
}
public void setVeiculos(ArrayList<Veiculo> veiculos) {
this.veiculos = veiculos;
}
public String getCpfCliente() {
return cpfCliente;
}
public void setCpfCliente(String cpfCliente) {
this.cpfCliente = cpfCliente;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getTelefoneCliente() {
return telefoneCliente;
}
public void setTelefoneCliente(String telefoneCliente) {
this.telefoneCliente = telefoneCliente;
}
}