java - Is it possible to specify the path of a chosen image with a variable? -


is possible determine path of chosen image variable? this:

private jlabel label = new jlabel(); int number = 1; label.seticon(new imageicon(getclass().getresource("/image" + number + ".png"))); 

in case not work, idea might clear. in case change variable name in order change path of image. know how so?


Comments

Popular posts from this blog

bash - Performing variable substitution in a string -

How to group boxplot outliers in gnuplot -