In your code, try this:
if (n == true) {
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
trofeo1.setIcon(new ImageIcon("trofeo.png"));
}
});
}
Maybe you can check first the image file is right by doing something like this:
File f = new File("trofeo.png");
if (f.exists()) {
} else {
}
This is because many times the problem is the image location.
Then, you say "maybe my sintaxis is the problem...", does your code compile? Have you put a breakpoint at trofeo1.setIcon()
line and check this line is executed? I assume the answer to these two questions is true.
Regards,