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