1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
class BoutonListener implements ActionListener
{
public void actionPerformed(ActionEvent click)
{
String boutonClique = click.getActionCommand();
if(boutonClique.equals("Ok"))
{
for(long l=0; l<99999999999999999L;l++)
{
sleep(1000);
compteur++;
jta.setText(compteur+"");
}
}
}
}
public void sleep(int temps)
{
try
{
Thread.sleep(temps);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
public void windowClosing(WindowEvent evt)
{
JOptionPane.showMessageDialog(null, "Fermeture fenêtre", "Information", 1);
System.out.println("Window closing");
System.exit(0);
} |
Partager