2
I’m making a program to calculate matrices, but I don’t know how to put an action to the "Confirm" button to take the typed values of the Textlabels (tl_rows and tl_columns) and pass to the variables Int x and Int Y.
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);
}
}
}
}