【发布时间】:2017-01-27 07:57:55
【问题描述】:
当 A 和 C 消失时,我希望按钮 B 和 D 保持在它们的位置上,而不是移到中心。我怎样才能让他们回到原来的位置?
fifty.setOnAction(e->{
fifty.setDisable(false);
int counter = 2;
ArrayList<String> variants = new ArrayList<>(Arrays.asList("a","b","c","d"));
variants.remove(trueAnswerIndex);
String variant;
int n = 2;
while(counter>0){
variant = variants.get(randInt(0,n));
switch(variant){
case "a":
gridButtons.getChildren().remove(a);
variants.remove("a");
break;
case "b":
gridButtons.getChildren().remove(b);
variants.remove("b");
break;
case "c":
gridButtons.getChildren().remove(c);
variants.remove("c");
break;
case "d":
gridButtons.getChildren().remove(d);
variants.remove("d");
break;
}
counter--;
n--;
}
});
【问题讨论】:
-
请在您的问题中包含您的代码。
标签: html button javafx row gridpane