implemented view upload and main fxml

This commit is contained in:
Jonas Hinterdorfer 2025-04-24 12:05:49 +02:00
parent 80f1275f63
commit e55658ff2e
8 changed files with 118 additions and 12 deletions

View File

@ -10,9 +10,9 @@ import java.io.IOException;
public class App extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("main.fxml"));
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("upload.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
stage.setTitle("Hello!");
stage.setTitle("Question Catalog");
stage.setScene(scene);
stage.show();
}

View File

@ -0,0 +1,4 @@
package at.ionas999.questioncatalog.controller;
public class MainController {
}

View File

@ -0,0 +1,16 @@
package at.ionas999.questioncatalog.controller;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
public class UploadController {
public ListView catalogListView;
public TextField newCatalogField;
public Button addCatalogButton;
public ListView catalogListViw;
public Button uploadButton;
public Label fileNameLabel;
public Button importButton;
}

View File

@ -0,0 +1,14 @@
package at.ionas999.questioncatalog.controller;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
public class ViewController{
public Button editButton;
public Button deleteButton;
public TextField answerField;
public ListView questionListView;
public TextField questionField;
}

View File

@ -2,7 +2,7 @@ module at.ionas999.questioncatalog {
requires javafx.controls;
requires javafx.fxml;
opens at.ionas999.questioncatalog to javafx.fxml;
opens at.ionas999.questioncatalog.controller to javafx.fxml; // Add this line
exports at.ionas999.questioncatalog;
}

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Button?>
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
</padding>
<Label fx:id="welcomeText"/>
<Button text="Hello!"/>
<Label text="Question Catalog" style="-fx-font-size: 24px; -fx-font-weight: bold;" />
<VBox spacing="10.0" alignment="CENTER">
<Button text="Add New" prefWidth="150" />
<Button text="View" prefWidth="149" />
<Button text="Learn" prefWidth="150" />
<Button text="Test" prefWidth="150" />
</VBox>
</VBox>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="at.ionas999.questioncatalog.controller.UploadController"
prefHeight="400.0" prefWidth="600.0">
<top>
<Label text="Upload Questions" style="-fx-font-size: 20; -fx-padding: 10;">
<BorderPane.margin>
<Insets bottom="10"/>
</BorderPane.margin>
</Label>
</top>
<left>
<VBox spacing="10" prefWidth="200">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
</padding>
<Label text="Select Catalog:"/>
<ListView fx:id="catalogListViw" VBox.vgrow="ALWAYS"/>
<HBox spacing="5">
<TextField fx:id="newCatalogField" promptText="New Catalog Name" HBox.hgrow="ALWAYS"/>
<Button fx:id="addCatalogButton" text="+"/>
</HBox>
</VBox>
</left>
<center>
<VBox spacing="10" alignment="TOP_CENTER">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
</padding>
<Label text="Upload CSV File"/>
<Button fx:id="uploadButton" text="Choose File"/>
<Label fx:id="fileNameLabel" text="No file selected"/>
<Button fx:id="importButton" text="Import Questions" disable="true"/>
</VBox>
</center>
</BorderPane>

View File

@ -0,0 +1,28 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="at.ionas999.questioncatalog.controller.ViewController"
prefHeight="400.0" prefWidth="600.0">
<left>
<ListView fx:id="questionListView" prefWidth="200.0" />
</left>
<center>
<VBox spacing="10.0">
<padding>
<Insets top="10.0" right="10.0" bottom="10.0" left="10.0"/>
</padding>
<TextField fx:id="questionField" editable="false" />
<TextField fx:id="answerField" promptText="Answer" editable="false" />
<HBox spacing="10.0" alignment="BOTTOM_RIGHT">
<Button fx:id="deleteButton" text="Delete" />
<Button fx:id="editButton" text="Edit" />
</HBox>
</VBox>
</center>
</BorderPane>