I would like to know how I can do so that after X seconds after executing a button, send me to a method that does what I have to do.
A bit of the context: I have a button that gives a jLabel1 with a .gif so I want half of the jbelle1 to run a method that shows me a jLabel2.
private void golpearActionPerformed(java.awt.event.ActionEvent evt) {
int x = Integer.parseInt(jTextField1.getText());
JOptionPane.showMessageDialog(null,"Pasaron x segundos pa que se baje la barra de vida");
//Esperar el tiempo y mandar al metodo
ataca(x);
}
basically I want to find a delay so that the gif is where I want it to be and then if I execute that method ataca(x)
to have a "synchronization"