mercredi 9 août 2017

How to randomly disable buttons in java

I have this program where I need to randomly disable some buttons so that the user is not able to select all of them. Is there a way to disable random buttons in java?

I was thinking of using Math.random, but I don't know how to start or refer to it.....

These are the buttons.

JButton but1 = new JButton();
JButton but2 = new JButton();
JButton but3 = new JButton();
JButton but4 = new JButton();
JButton but5 = new JButton();
JButton but6 = new JButton();
JButton but7 = new JButton();




Aucun commentaire:

Enregistrer un commentaire