Getting jLabel image url in Java
问题 I'll make it short. I've put a jLbl_show and in a if condition I've set an image for it. if(int c==1){ jLbl_show0.setIcon(new ImageIcon(getClass().getResource("/img/wrong.png"))); } else{ jLbl_show0.setIcon(new ImageIcon(getClass().getResource("/img/ok.png"))); } But, as now the image is set i need to take the image URL to another condition . which is like; if(imageURL is "/img/ok.png"){ do somthing } elseif (imgURL is "/img/wrong.png"){ do something } is there a way to do this? 回答1: do