From 9c555bca7ba5a4e5396245b2086df89ded7e0c8c Mon Sep 17 00:00:00 2001 From: AlisaLinUwU Date: Sun, 26 Jan 2025 11:35:35 +0500 Subject: Initialize --- Kahoot GUI.iml | 26 ++++ out/artifacts/Kahoot_GUI_Linux_jar/Kahoot GUI.jar | Bin 0 -> 8329961 bytes .../Kahoot_GUI_Windows_jar/Kahoot GUI.jar | Bin 0 -> 9326097 bytes out/classes/sample/Controller.class | Bin 0 -> 5409 bytes out/classes/sample/Main.class | Bin 0 -> 1363 bytes out/classes/sample/Questions.class | Bin 0 -> 732 bytes out/classes/sample/images/liist.png | Bin 0 -> 15390 bytes out/classes/sample/images/logo.png | Bin 0 -> 22534 bytes out/classes/sample/images/search.png | Bin 0 -> 17770 bytes out/classes/sample/sample.fxml | 164 +++++++++++++++++++++ out/classes/sample/styles/main.css | 10 ++ pom.xml | 77 ++++++++++ src/main/java/.DS_Store | Bin 0 -> 6148 bytes src/main/java/kahootgui/.DS_Store | Bin 0 -> 6148 bytes src/main/java/kahootgui/App.java | 25 ++++ src/main/java/kahootgui/Controller.java | 97 ++++++++++++ src/main/java/kahootgui/Main.java | 9 ++ src/main/java/kahootgui/Questions.java | 25 ++++ src/main/resources/META-INF/MANIFEST.MF | 3 + src/main/resources/kahootgui/images/list.png | Bin 0 -> 15390 bytes src/main/resources/kahootgui/images/logo.png | Bin 0 -> 22534 bytes src/main/resources/kahootgui/images/search.png | Bin 0 -> 17770 bytes src/main/resources/kahootgui/main.fxml | 164 +++++++++++++++++++++ src/main/resources/kahootgui/styles/main.css | 10 ++ target/classes/META-INF/MANIFEST.MF | 3 + target/classes/kahootgui/App.class | Bin 0 -> 1364 bytes target/classes/kahootgui/Controller.class | Bin 0 -> 5424 bytes target/classes/kahootgui/Main.class | Bin 0 -> 412 bytes target/classes/kahootgui/Questions.class | Bin 0 -> 738 bytes target/classes/kahootgui/images/list.png | Bin 0 -> 15390 bytes target/classes/kahootgui/images/logo.png | Bin 0 -> 22534 bytes target/classes/kahootgui/images/search.png | Bin 0 -> 17770 bytes target/classes/kahootgui/main.fxml | 164 +++++++++++++++++++++ target/classes/kahootgui/styles/main.css | 10 ++ 34 files changed, 787 insertions(+) create mode 100644 Kahoot GUI.iml create mode 100644 out/artifacts/Kahoot_GUI_Linux_jar/Kahoot GUI.jar create mode 100644 out/artifacts/Kahoot_GUI_Windows_jar/Kahoot GUI.jar create mode 100644 out/classes/sample/Controller.class create mode 100644 out/classes/sample/Main.class create mode 100644 out/classes/sample/Questions.class create mode 100644 out/classes/sample/images/liist.png create mode 100644 out/classes/sample/images/logo.png create mode 100644 out/classes/sample/images/search.png create mode 100644 out/classes/sample/sample.fxml create mode 100644 out/classes/sample/styles/main.css create mode 100644 pom.xml create mode 100644 src/main/java/.DS_Store create mode 100644 src/main/java/kahootgui/.DS_Store create mode 100644 src/main/java/kahootgui/App.java create mode 100644 src/main/java/kahootgui/Controller.java create mode 100644 src/main/java/kahootgui/Main.java create mode 100644 src/main/java/kahootgui/Questions.java create mode 100644 src/main/resources/META-INF/MANIFEST.MF create mode 100644 src/main/resources/kahootgui/images/list.png create mode 100644 src/main/resources/kahootgui/images/logo.png create mode 100644 src/main/resources/kahootgui/images/search.png create mode 100644 src/main/resources/kahootgui/main.fxml create mode 100644 src/main/resources/kahootgui/styles/main.css create mode 100644 target/classes/META-INF/MANIFEST.MF create mode 100644 target/classes/kahootgui/App.class create mode 100644 target/classes/kahootgui/Controller.class create mode 100644 target/classes/kahootgui/Main.class create mode 100644 target/classes/kahootgui/Questions.class create mode 100644 target/classes/kahootgui/images/list.png create mode 100644 target/classes/kahootgui/images/logo.png create mode 100644 target/classes/kahootgui/images/search.png create mode 100644 target/classes/kahootgui/main.fxml create mode 100644 target/classes/kahootgui/styles/main.css diff --git a/Kahoot GUI.iml b/Kahoot GUI.iml new file mode 100644 index 0000000..ffb3fff --- /dev/null +++ b/Kahoot GUI.iml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/out/artifacts/Kahoot_GUI_Linux_jar/Kahoot GUI.jar b/out/artifacts/Kahoot_GUI_Linux_jar/Kahoot GUI.jar new file mode 100644 index 0000000..e7715aa Binary files /dev/null and b/out/artifacts/Kahoot_GUI_Linux_jar/Kahoot GUI.jar differ diff --git a/out/artifacts/Kahoot_GUI_Windows_jar/Kahoot GUI.jar b/out/artifacts/Kahoot_GUI_Windows_jar/Kahoot GUI.jar new file mode 100644 index 0000000..d990423 Binary files /dev/null and b/out/artifacts/Kahoot_GUI_Windows_jar/Kahoot GUI.jar differ diff --git a/out/classes/sample/Controller.class b/out/classes/sample/Controller.class new file mode 100644 index 0000000..cef7944 Binary files /dev/null and b/out/classes/sample/Controller.class differ diff --git a/out/classes/sample/Main.class b/out/classes/sample/Main.class new file mode 100644 index 0000000..cab1eaa Binary files /dev/null and b/out/classes/sample/Main.class differ diff --git a/out/classes/sample/Questions.class b/out/classes/sample/Questions.class new file mode 100644 index 0000000..48f91d7 Binary files /dev/null and b/out/classes/sample/Questions.class differ diff --git a/out/classes/sample/images/liist.png b/out/classes/sample/images/liist.png new file mode 100644 index 0000000..abdde73 Binary files /dev/null and b/out/classes/sample/images/liist.png differ diff --git a/out/classes/sample/images/logo.png b/out/classes/sample/images/logo.png new file mode 100644 index 0000000..ddef2cf Binary files /dev/null and b/out/classes/sample/images/logo.png differ diff --git a/out/classes/sample/images/search.png b/out/classes/sample/images/search.png new file mode 100644 index 0000000..00400c6 Binary files /dev/null and b/out/classes/sample/images/search.png differ diff --git a/out/classes/sample/sample.fxml b/out/classes/sample/sample.fxml new file mode 100644 index 0000000..a65c9f1 --- /dev/null +++ b/out/classes/sample/sample.fxml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/out/classes/sample/styles/main.css b/out/classes/sample/styles/main.css new file mode 100644 index 0000000..90a7c9f --- /dev/null +++ b/out/classes/sample/styles/main.css @@ -0,0 +1,10 @@ +.button:hover { + -fx-background-color: #383838!important; + -fx-border-color: #383838!important; + -fx-text-fill: #fff!important; +} + +.button:pressed { + -fx-scale-y: 0.95; + -fx-scale-x: 0.95; +} \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..eb4fbb9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + groupId + som + 1.0-SNAPSHOT + + + UTF-8 + 5.8.2 + + + + + org.openjfx + javafx-base + 18.0.1 + win + + + org.openjfx + javafx-fxml + 18.0.1 + win + + + org.openjfx + javafx-controls + 18.0.1 + win + + + org.openjfx + javafx-graphics + 18.0.1 + win + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 18 + 18 + + + + org.openjfx + javafx-maven-plugin + 0.0.8 + + + + default-cli + + kahootgui.Main + app + app + app + true + true + true + + + + + + + + \ No newline at end of file diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/src/main/java/.DS_Store differ diff --git a/src/main/java/kahootgui/.DS_Store b/src/main/java/kahootgui/.DS_Store new file mode 100644 index 0000000..09747aa Binary files /dev/null and b/src/main/java/kahootgui/.DS_Store differ diff --git a/src/main/java/kahootgui/App.java b/src/main/java/kahootgui/App.java new file mode 100644 index 0000000..5dae92b --- /dev/null +++ b/src/main/java/kahootgui/App.java @@ -0,0 +1,25 @@ +package kahootgui; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.util.Objects; + +public class App extends Application { + + @Override + public void start(Stage primaryStage) throws Exception { + Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("main.fxml"))); + primaryStage.setTitle("Тесты по языка программирования"); + primaryStage.setScene(new Scene(root, 747, 460)); + primaryStage.show(); + } + + public static void main(String[] args) { + launch(args); + } + +} diff --git a/src/main/java/kahootgui/Controller.java b/src/main/java/kahootgui/Controller.java new file mode 100644 index 0000000..476f9f1 --- /dev/null +++ b/src/main/java/kahootgui/Controller.java @@ -0,0 +1,97 @@ +package kahootgui; + +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.RadioButton; +import javafx.scene.control.ToggleGroup; +import javafx.scene.text.Text; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class Controller { + + @FXML + private ToggleGroup answers; + + @FXML + private Text question_text; + + @FXML + private RadioButton radio_btn_1; + + @FXML + private RadioButton radio_btn_2; + + @FXML + private RadioButton radio_btn_3; + + @FXML + private RadioButton radio_btn_4; + + @FXML + private Button answerBtn; + + private final Questions[] questions = new Questions[] { + new Questions("В каком из вариантов представлен корректный формат вывода информации на экран?", new String[] {"Console.Write()", "console.log()", "print()", "System.out.println()"}), + new Questions("Какой тип данных отвечает за целые числа?", new String[] {"String", "Float", "Boolean", "Integer"}), + new Questions("Где правильно присвоено новое значение к многомерному массиву?", new String[] {"a(0)(0) = 1;", "a[0 0] = 1;", "a{0}{0} = 1;", "a[0][0] = 1;"}), + new Questions("Какой метод позволяет запустить программу на Java?", new String[] {"Основного метода нет", "С класса, что был написан первым и с методов что есть внутри него", "Любой, его можно задавать в настройках проекта", "С метода main в любом из классов"}), + new Questions("Каждый файл должен называется...", new String[] {"по имени первой библиотеки в нём", "по имени названия пакета", "как вам захочется", "по имени класса в нём"}), + new Questions("Сколько параметров может принимать функция?", new String[] {"5", "10", "20", "неограниченное количество"}) + }; + + private int nowQuestion = 0, correctAnswers; + private String nowCorrectAnswer; + + @FXML + public void initialize() { + nowCorrectAnswer = questions[nowQuestion].correctAnswer(); + + answerBtn.setOnAction(e -> { + RadioButton selectedRadioButton = (RadioButton) answers.getSelectedToggle(); + if(selectedRadioButton != null) { + String toogleGroupValue = selectedRadioButton.getText(); + + if(toogleGroupValue.equals(nowCorrectAnswer)) { + System.out.println("Верный ответ"); + correctAnswers++; + } else { + System.out.println("Не верный ответ"); + } + + // Это был последний вопрос + if(nowQuestion + 1 == questions.length) { + radio_btn_1.setVisible(false); + radio_btn_2.setVisible(false); + radio_btn_3.setVisible(false); + radio_btn_4.setVisible(false); + answerBtn.setVisible(false); + + question_text.setText("Вы ответили корректно на " + correctAnswers + " из " + questions.length + " вопросов!"); + } else { + nowQuestion++; + nowCorrectAnswer = questions[nowQuestion].correctAnswer(); + + question_text.setText(questions[nowQuestion].getQuestion()); + String[] answers = questions[nowQuestion].getAnswers(); + + + List intList = Arrays.asList(answers); + + Collections.shuffle(intList); + + radio_btn_1.setText(intList.get(0)); + radio_btn_2.setText(intList.get(1)); + radio_btn_3.setText(intList.get(2)); + radio_btn_4.setText(intList.get(3)); + + selectedRadioButton.setSelected(false); + } + + } + }); + } + +} diff --git a/src/main/java/kahootgui/Main.java b/src/main/java/kahootgui/Main.java new file mode 100644 index 0000000..bbcccb1 --- /dev/null +++ b/src/main/java/kahootgui/Main.java @@ -0,0 +1,9 @@ +package kahootgui; + +public class Main { + + public static void main(String[] args) { + App.main(args); + } + +} diff --git a/src/main/java/kahootgui/Questions.java b/src/main/java/kahootgui/Questions.java new file mode 100644 index 0000000..44bbe34 --- /dev/null +++ b/src/main/java/kahootgui/Questions.java @@ -0,0 +1,25 @@ +package kahootgui; + +public class Questions { + + private String question; + private String[] answers; + + public Questions(String question, String[] answers) { + this.question = question; + this.answers = answers; + } + + public String correctAnswer() { + return this.answers[answers.length - 1]; + } + + public String getQuestion() { + return question; + } + + public String[] getAnswers() { + return answers; + } + +} diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..69fbd7c --- /dev/null +++ b/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: kahootgui.Main + diff --git a/src/main/resources/kahootgui/images/list.png b/src/main/resources/kahootgui/images/list.png new file mode 100644 index 0000000..abdde73 Binary files /dev/null and b/src/main/resources/kahootgui/images/list.png differ diff --git a/src/main/resources/kahootgui/images/logo.png b/src/main/resources/kahootgui/images/logo.png new file mode 100644 index 0000000..ddef2cf Binary files /dev/null and b/src/main/resources/kahootgui/images/logo.png differ diff --git a/src/main/resources/kahootgui/images/search.png b/src/main/resources/kahootgui/images/search.png new file mode 100644 index 0000000..00400c6 Binary files /dev/null and b/src/main/resources/kahootgui/images/search.png differ diff --git a/src/main/resources/kahootgui/main.fxml b/src/main/resources/kahootgui/main.fxml new file mode 100644 index 0000000..1bae894 --- /dev/null +++ b/src/main/resources/kahootgui/main.fxml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/kahootgui/styles/main.css b/src/main/resources/kahootgui/styles/main.css new file mode 100644 index 0000000..90a7c9f --- /dev/null +++ b/src/main/resources/kahootgui/styles/main.css @@ -0,0 +1,10 @@ +.button:hover { + -fx-background-color: #383838!important; + -fx-border-color: #383838!important; + -fx-text-fill: #fff!important; +} + +.button:pressed { + -fx-scale-y: 0.95; + -fx-scale-x: 0.95; +} \ No newline at end of file diff --git a/target/classes/META-INF/MANIFEST.MF b/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..69fbd7c --- /dev/null +++ b/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: kahootgui.Main + diff --git a/target/classes/kahootgui/App.class b/target/classes/kahootgui/App.class new file mode 100644 index 0000000..fb35fee Binary files /dev/null and b/target/classes/kahootgui/App.class differ diff --git a/target/classes/kahootgui/Controller.class b/target/classes/kahootgui/Controller.class new file mode 100644 index 0000000..8c7daa0 Binary files /dev/null and b/target/classes/kahootgui/Controller.class differ diff --git a/target/classes/kahootgui/Main.class b/target/classes/kahootgui/Main.class new file mode 100644 index 0000000..fe9e963 Binary files /dev/null and b/target/classes/kahootgui/Main.class differ diff --git a/target/classes/kahootgui/Questions.class b/target/classes/kahootgui/Questions.class new file mode 100644 index 0000000..4661a44 Binary files /dev/null and b/target/classes/kahootgui/Questions.class differ diff --git a/target/classes/kahootgui/images/list.png b/target/classes/kahootgui/images/list.png new file mode 100644 index 0000000..abdde73 Binary files /dev/null and b/target/classes/kahootgui/images/list.png differ diff --git a/target/classes/kahootgui/images/logo.png b/target/classes/kahootgui/images/logo.png new file mode 100644 index 0000000..ddef2cf Binary files /dev/null and b/target/classes/kahootgui/images/logo.png differ diff --git a/target/classes/kahootgui/images/search.png b/target/classes/kahootgui/images/search.png new file mode 100644 index 0000000..00400c6 Binary files /dev/null and b/target/classes/kahootgui/images/search.png differ diff --git a/target/classes/kahootgui/main.fxml b/target/classes/kahootgui/main.fxml new file mode 100644 index 0000000..1bae894 --- /dev/null +++ b/target/classes/kahootgui/main.fxml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/target/classes/kahootgui/styles/main.css b/target/classes/kahootgui/styles/main.css new file mode 100644 index 0000000..90a7c9f --- /dev/null +++ b/target/classes/kahootgui/styles/main.css @@ -0,0 +1,10 @@ +.button:hover { + -fx-background-color: #383838!important; + -fx-border-color: #383838!important; + -fx-text-fill: #fff!important; +} + +.button:pressed { + -fx-scale-y: 0.95; + -fx-scale-x: 0.95; +} \ No newline at end of file -- cgit v1.2.3