Reuse a timer timertask Java
<p>Soo created a timer using extending timertask.</p>

<pre><code>label_1.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                label_1.setVisible(false);
                label_2.setVisible(true);
                timer.purge();
                class MyTimeTask extends TimerTask
        {   
            public void run(){
            genReelNumbers();
            laa++;
           if(laa==50){
            timer.cancel();
            timer.purge();
                laa=0;
            label_1.setVisible(true);
            label_2.setVisible(false);}}}
                timer.purge();
                timer.schedule(new MyTimeTask(), 0, 50);}});
</code></pre>

<p>But im getting a error with the timer already canceled! As you can see i already tried to use the purge(), soo it cancels the "canceled" timers (dont know if that does make any sence). I want to use this timer each time that i press on the label! Any ideas?</p>