How popular is Jtable?

Asked

Viewed 63 times

0

I have to fill out a table with bank data. But nothing appears at all.

inserir a descrição da imagem aqui

My Class

Inserting information in the table:

 DefaultTableModel dtm = new DefaultTableModel();
    String sql = "select * from eventos";

ResultSet rs = null;
try {
rs = stmt.executeQuery(query);
} catch (SQLException ex) {
Logger.getLogger(folha.class.getName()).log(Level.SEVERE, null, ex);
}


try {
while (rs.next()) {
    //pega os valores do bd para popular tabela
    dtm.addRow(new String[] {rs.getString("codEvento"), rs.getString("descricaoEvento"), rs.getString("referencia"), rs.getString("vencimento"), rs.getString("desconto") });
}
}catch (SQLException ex) {
        Logger.getLogger(folha.class.getName()).log(Level.SEVERE, null, ex);
}    
  • 1
  • If you read the accepted answer of these two questions, you will be more than able to do what you intend.

  • The data comes from the database...

  • The first question has the answer to this. The second I teach step by step how to "model" the table according to the "taste",

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.