mardi 14 mars 2017

Java Swing: get a random JButton from an ArrayList of JButtons

I have some buttons in an ArrayList, I want to choose a random one, I tried this code but I don't know how to fix it

ArrayList<JButton> vide = new ArrayList<JButton>();
Random btn = new Random();
vide.get(btn.next(btn.size()));
btn.setText("O");

thanks




Aucun commentaire:

Enregistrer un commentaire