Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Changing Icon of a JLabel

$
0
0
Good day friends,

What I am trying to do is change the Icon of a label,depending on the value of a variable.

What I did is this :

 ImageIcon icon = new ImageIcon("C:\\Dice_2.jpg");
       if(roll==2) lbl_dice.setIcon(icon);


But it wont work.I also get no errors.
What happens is that when roll==2,the label just disappears...

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>