Reputation: 200
I have this code...it's working, but I'd like to open a new JTable and show results rather than having a JTable inside a JFrame. I've been struggling to find a solution but couldn't, can anyone help me?
try {
String SQL ="SELECT * From Giocatori Where lower(Nome)= lower(?)";
PreparedStatement preparedStatement = con.prepareStatement(SQL);
String nome= ricercaetichetta.getText();
preparedStatement.setString(1, nome.toLowerCase());
//SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
// System.out.println(nome);
rs = preparedStatement.executeQuery();
// risultati.append("Codice Fir | Nome | Cognome | Scadenza Visita"+"\n"+"\n");
tabella.setModel(DbUtils.resultSetToTableModel(rs));
<-- As you can see, I have to insert JTable before the query.
I'd like to make it appear only after I click on the button...(in the same frame or another).
Upvotes: 1
Views: 826
Reputation: 2362
use setvisible()
in build method u can hide or show the tabele. using that method u can do what u want.
setvisble examples
Upvotes: 1