implemented the go back

This commit is contained in:
Jonas Hinterdorfer 2025-05-13 12:23:46 +02:00
parent 8502728738
commit 14962172f9
8 changed files with 52 additions and 1 deletions

View File

@ -1,14 +1,18 @@
package at.ionas999.questioncatalog.controller;
import at.ionas999.questioncatalog.Utils;
import at.ionas999.questioncatalog.model.Question;
import at.ionas999.questioncatalog.model.QuestionCatalog;
import at.ionas999.questioncatalog.services.QuestionCatalogService;
import at.ionas999.questioncatalog.services.QuestionService;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
@ -83,4 +87,10 @@ public class AnswerTextController {
private void onIncorrectBtnClick() {
showNextQuestion();
}
@FXML
private void onBackToMainPageClick(ActionEvent actionEvent) throws IOException {
Stage stage = Utils.getStageFromActionEven(actionEvent);
Utils.switchScenes("main.fxml", stage);
}
}

View File

@ -13,8 +13,10 @@ import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.stage.Stage;
import javafx.util.converter.NumberStringConverter;
import java.io.IOException;
import java.lang.reflect.Array;
import java.sql.SQLException;
import java.util.ArrayList;
@ -151,4 +153,11 @@ public class TestController {
{
this.userAnswerArea.setText("Correct: %d \nIncorrect: %d\n".formatted(correctCount, inCorrectCount));
}
@FXML
private void onBackToMainPageClick(ActionEvent actionEvent) throws IOException {
Stage stage = Utils.getStageFromActionEven(actionEvent);
Utils.switchScenes("main.fxml", stage);
}
}

View File

@ -10,7 +10,9 @@ import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.SQLException;
public class UploadController {
@ -61,4 +63,10 @@ public class UploadController {
}
csvContentArea.clear();
}
@FXML
private void onBackToMainPageClick(ActionEvent actionEvent) throws IOException {
Stage stage = Utils.getStageFromActionEven(actionEvent);
Utils.switchScenes("main.fxml", stage);
}
}

View File

@ -1,5 +1,6 @@
package at.ionas999.questioncatalog.controller;
import at.ionas999.questioncatalog.Utils;
import at.ionas999.questioncatalog.model.Question;
import at.ionas999.questioncatalog.model.QuestionCatalog;
import at.ionas999.questioncatalog.services.QuestionCatalogService;
@ -12,9 +13,12 @@ import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.SQLException;
import static at.ionas999.questioncatalog.Utils.showConfirmationButton;
@ -96,4 +100,10 @@ public class ViewController {
isInEditState.set(true);
}
}
@FXML
private void onBackToMainPageClick(ActionEvent actionEvent) throws IOException {
Stage stage = Utils.getStageFromActionEven(actionEvent);
Utils.switchScenes("main.fxml", stage);
}
}

View File

@ -32,5 +32,8 @@
<HBox alignment="TOP_RIGHT" spacing="10.0" AnchorPane.topAnchor="10.0" AnchorPane.rightAnchor="10.0">
<ComboBox fx:id="selectBox" promptText="Select a Catalog"/>
</HBox>
<!-- Back to Main Page Button -->
<Button text="Back to Main Page" onAction="#onBackToMainPageClick"
AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0"/>
</children>
</AnchorPane>

View File

@ -41,5 +41,7 @@
<Button text="Incorrect" fx:id="incorrectBtn" onAction="#onIncorrectBtnClick"/>
</HBox>
</VBox>
<Button text="Back to Main Page" onAction="#onBackToMainPageClick"
AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0"/>
</children>
</AnchorPane>

View File

@ -42,4 +42,9 @@
<Button fx:id="importButton" text="Import Questions" onAction="#onImportBtnClick"/>
</VBox>
</center>
<bottom>
<HBox alignment="CENTER_RIGHT" spacing="10.0">
<Button text="Back to Main Page" onAction="#onBackToMainPageClick" />
</HBox>
</bottom>
</BorderPane>

View File

@ -38,5 +38,9 @@
</HBox>
</VBox>
</center>
<bottom>
<HBox alignment="CENTER_RIGHT" spacing="10.0">
<Button text="Back to Main Page" onAction="#onBackToMainPageClick" />
</HBox>
</bottom>
</BorderPane>