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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| private int resaffi(JLabel x) throws InterruptedException
{
x.setVisible(false);
x.setOpaque(true);
x.setBackground(Color.ORANGE);
x.setVisible(true);
int s;
int bol= JOptionPane.showConfirmDialog(null, "?", "Attention!",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE);
if (bol==JOptionPane.YES_OPTION)
{
boolean test=testrep(x.getText());
if (test)
{
x.setVisible(false);
x.setOpaque(true);
x.setBackground(Color.GREEN);
x.setVisible(true);
clip.stop();
setmusic("vrai");
s=1;
}
else
{
x.setVisible(false);
x.setBackground(Color.red);
x.setVisible(true);
if (testrep(a.getText()))
{
a.setVisible(false);
a.setOpaque(true);
a.setBackground(Color.GREEN);
a.setVisible(true);
}
if (testrep(b.getText()))
{
b.setVisible(false);
b.setOpaque(true);
b.setBackground(Color.GREEN);
b.setVisible(true);
}
if (testrep(c.getText()))
{
c.setVisible(false);
c.setOpaque(true);
c.setBackground(Color.GREEN);
c.setVisible(true);
}
if (testrep(d.getText()))
{
d.setVisible(false);
d.setOpaque(true);
d.setBackground(Color.GREEN);
d.setVisible(true);
}
clip.stop();
setmusic("faux");
s=-1;
}
}
else
{
x.setVisible(false);
x.setOpaque(false);
x.setVisible(true);
s=0;
}
revalidate();
repaint();
clip.stop();
setmusic(lvl);
return s;
} |
Partager