我有 4 个按钮。
我有 4 个不同的字符串。
我想随机填充 4 按钮的文本* 我怎样才能简单地编码?
这是代码:
switch(randomInt)
{
case 0:
Button01.setText(livreFromBdd.getproposition1());
Button02.setText(livreFromBdd.getproposition2());
Button03.setText(livreFromBdd.getproposition3());
Button04.setText(livreFromBdd.getproposition4());
case 1:
Button01.setText(livreFromBdd.getproposition4());
Button02.setText(livreFromBdd.getproposition1());
Button03.setText(livreFromBdd.getproposition2());
Button04.setText(livreFromBdd.getproposition3());
case 2:
Button01.setText(livreFromBdd.getproposition3());
Button02.setText(livreFromBdd.getproposition4());
Button03.setText(livreFromBdd.getproposition1());
Button04.setText(livreFromBdd.getproposition2());
case 3:
Button01.setText(livreFromBdd.getproposition2());
Button02.setText(livreFromBdd.getproposition3());
Button03.setText(livreFromBdd.getproposition4());
Button04.setText(livreFromBdd.getproposition1());
.... etc
我想我可以做点别的,更简单,有什么想法吗?
谢谢,