This is my code:
@Override
public void mousePressed(MouseEvent arg0)
{
this.setIcon(obr);
if(p.getAktivni() == null)
p.setAktivni(this);
else
{
if(this.jeStejne(p.getAktivni()))
{
p.nalezeno();
this.zmiz();
}
else
{
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
p.nenalezeno(this);
}
}
}
This points to JLabel.
The problem is the Thread.Sleep()
runs before the this.setIcon(obr)
;
Why is that and how is that even possible?