I have an issue when I tried to create multiple buttons with the same value of "x". How can I fix this issue or perhaps get the value of the buttons and then delete the specific element in an array with the same index as my button without deleting other elements as it loops through the for loop?
Button[] delButton = new Button[sizeOfIt]; //sizeOfIt is the size of array
for (int m=0; m <sizeOfIt; m++) {
delButton[m] = new Button("x");
}
for(int x = 0; x < delButton.length; x++) {
delButton[x].setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
// delete the element in the array with the same index as my button i clicked
}
});
}
Buttonfrom theSceneor remove it from theArray?