I'm doing a program to calculate arrays, but I do not know how by an action for the "Confirm" button to get the values typed in the TextLabels (tl_lines and tl_columns) and move to the Int x and Int Y variables.
package matrizes;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
public class FXMLDocumentController implements Initializable {
@FXML
private TextField tf_linhas;
@FXML
private Button btnTexto;
@FXML
private Button btnLC;
@FXML
private TextField tf_colunas;
@FXML
private final AnchorPane apMatriz = new AnchorPane();
public void btnLC(ActionEvent e){
}
@Override
public void initialize(URL url, ResourceBundle rb) {
int x = 0;
int y = 0;
for(int i = 1; i < x+1; i++) {
for(int j = 1; j < y+1; j++){
Button btn = new Button();
btn.setPrefWidth(40);
btn.setLayoutX(i*45);
btn.setLayoutY(j*30);
btn.setText("a"+i+""+j);
apMatriz.getChildren().add(btn);
}
}
}
}