Stop Button
This commit is contained in:
@ -62,28 +62,39 @@ public class Controller_Frontend {
|
||||
@FXML
|
||||
private Label intconLabel;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private Button stepButton;
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private Button autoRunGUI;
|
||||
|
||||
@FXML
|
||||
private Button stopButton;
|
||||
|
||||
|
||||
|
||||
|
||||
private volatile boolean isAutoRunActive = true;
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void stopAutoRun(ActionEvent event) {
|
||||
|
||||
isAutoRunActive = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void autoRunGUI(ActionEvent event) {
|
||||
if (!isAutoRunActive) {
|
||||
isAutoRunActive = true;
|
||||
}
|
||||
Thread autoRunThread = new Thread(() -> {
|
||||
try {
|
||||
while (DataRegister.getPC() < prog.length) {
|
||||
while (DataRegister.getPC() < prog.length && isAutoRunActive){
|
||||
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
@ -92,7 +103,7 @@ public class Controller_Frontend {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
Thread.sleep(200); // Millisekunden
|
||||
Thread.sleep(200); //Verzögerungszeit in Millisekunden
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
@ -100,9 +111,12 @@ public class Controller_Frontend {
|
||||
});
|
||||
autoRunThread.setDaemon(true);
|
||||
autoRunThread.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void stepintoButton(ActionEvent event) throws IOException {
|
||||
if (lstContentListView.getItems().isEmpty()) {
|
||||
@ -295,6 +309,7 @@ public class Controller_Frontend {
|
||||
|
||||
lstContentListView.getStylesheets().add(Objects.requireNonNull(getClass().getResource("styles.css")).toExternalForm());
|
||||
autoRunGUI.setOnAction(this::autoRunGUI);
|
||||
stopButton.setOnAction(this::stopAutoRun);
|
||||
}
|
||||
|
||||
private static void setTRISbuttons(ToggleButtonGroup[] allButtons) {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
|
||||
.list-cell:selected {
|
||||
-fx-background-color: yellow;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
<!--RIchtiger AUtorun button für die Gui der funktioniert -->
|
||||
<Button fx:id="autoRunGUI" layoutX="182.0" layoutY="400.0" text="Auto Run" onAction="#autoRunGUI"/>
|
||||
<Button fx:id="stopButton" layoutX="302.0" layoutY="400.0" text="Stop" onAction="#stopAutoRun"/>
|
||||
|
||||
<HBox layoutX="807.0" layoutY="134.0" prefHeight="293.0" prefWidth="701.0">
|
||||
<children>
|
||||
|
||||
Reference in New Issue
Block a user