java - Select Randomly an object from a list (Image) -
guys wondering if way put list of example jlabels, , method select randomly 1 of them.
and if jlabels images still work??
thanks answers;)
yes it's possible:
random r = new random(); list<jlabel> yourlist; //populate list beforehand. yourlist.add(jlabel blah); , on jlabel randomjlabel = yourlist.get(r.nextint(yourlist.size()));