I'm new to programming for desktop, well, I'm doing a program in java using swing and sqlite database, I already did some things work, but after login the jframe that should open a single opens twice, how to fix this?
Follow the coidigo
private void entrar() {
String sql = "select * from login where usuario = ? and senha = ?";
try {
conn = conexao.ConnectionDB();
pst = conn.prepareStatement(sql);
pst.setString(1, nomeUser.getText());
pst.setString(2, senhaUser.getText());
rs = pst.executeQuery();
if (rs.next()) {
new TelaPrincipal().setVisible(true);
this.dispose();
} else {
JOptionPane.showMessageDialog(null, "Login inexistente");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}