Browse Source

linked calculating the Determinants of the input Matrices to their Buttons

featureMatrixCalculator
Lukas Reichwein 5 years ago
parent
commit
95d3d1cb28
  1. 36
      src/main/java/com/ugsbo/matrixcalc/MatrixCalcController.java

36
src/main/java/com/ugsbo/matrixcalc/MatrixCalcController.java

@ -9,7 +9,7 @@ public class MatrixCalcController {
// Hier werden die fx:id Attribute verknuepft.
@FXML
private Button multiplyButton, addButton, swapInputButton, substractButton, transposeButton;
private Button multiplyButton, addButton, DetAButton, DetBButton, substractButton, transposeButton;
@FXML
private Text errorText, outputText;
@FXML
@ -105,5 +105,39 @@ public class MatrixCalcController {
outputText.setTextAlignment(TextAlignment.CENTER);
}
});
DetAButton.setOnMouseClicked((event) -> {
MatrixCalcMath math = new MatrixCalcMath();
MatrixCalcIOUtils util = new MatrixCalcIOUtils();
String stringMatrixA = matrixATextArea.getText();
if (util.checkInput(stringMatrixA)) {
double[][] matrixA = util.stringToMatrix(stringMatrixA);
double result = math.calcDeterminat(matrixA);
String DisplayableString = Double.toString(result);
outputText.setText(DisplayableString);
outputText.setTextAlignment(TextAlignment.CENTER);
}
});
DetBButton.setOnMouseClicked((event) -> {
MatrixCalcMath math = new MatrixCalcMath();
MatrixCalcIOUtils util = new MatrixCalcIOUtils();
String stringMatrixB = matrixBTextArea.getText();
if (util.checkInput(stringMatrixB)) {
double[][] matrixB = util.stringToMatrix(stringMatrixB);
double result = math.calcDeterminat(matrixB);
String DisplayableString = Double.toString(result);
outputText.setText(DisplayableString);
outputText.setTextAlignment(TextAlignment.CENTER);
}
});
}
}
Loading…
Cancel
Save