guys I was wondering if it was a way to put a list of for example JLabels, and with a method select randomly one of them.
And if the JLabels are the images it will still work??
Thanks for all your answers;)
guys I was wondering if it was a way to put a list of for example JLabels, and with a method select randomly one of them.
And if the JLabels are the images it will still work??
Thanks for all your answers;)
Yes it's possible:
Random r = new Random();
List<JLabel> yourList; //populate your list beforehand. yourList.add(JLabel blah); and so on
JLabel randomJLabel = yourList.get(r.nextInt(yourList.size()));