Hello!
As a college assignment, I'm finishing a small applet that communicates with a MySQL database (through a Java server via RMI - all this is part of the assignment).
It's doing all it should except for one thing: in one of the tabs I included a JTable that lists all the records available in the database OR populates it based on a query, but I can't update it when I need to.
What I've already succeeded in doing: when the applet loads the JTable is populated with all the database records. Great!
What I'm getting desperate to learn how to do: update the JTable everytime I insert/delete/update records in the database.
I'm getting the info from the server though a String array (two dimensions).
This is the code I have for the JTable:
tabelaConsulta.setModel(new javax.swing.table.DefaultTableModel(data,Columnnames) {
boolean[] canEdit = new boolean [] {false, false, false, false, false};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(tabelaConsulta);
The table info is being carried by the variable data and Columnames is just an Array containing the names for the columns.
I'd really appreciate any ideas.
Thanks!
[]s
Marcos, Brazil.