Added flashcard project that implements the arrow buttons

This commit is contained in:
top19 2020-04-19 16:37:24 +01:00
parent 630f089ac0
commit fbde4e6ec4
20 changed files with 77 additions and 32 deletions

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/hellofx.iml" filepath="$PROJECT_DIR$/.idea/hellofx.iml" />
</modules>
</component>
</project>

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../../.." vcs="Git" />
</component>
</project>

View file

@ -155,8 +155,8 @@
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="343" />
<option name="y" value="113" />
<option name="x" value="196" />
<option name="y" value="75" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
@ -264,7 +264,7 @@
</component>
<component name="PropertiesComponent">
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="M:/Year2/JsonTest1.1/JsonTest1.1" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.0" />

View file

@ -4,9 +4,10 @@ public class WelshDictionary {
private String english;
private String welsh;
private String wordType;
private boolean practiceWord;
public WelshDictionary() {
practiceWord = false;
}
public WelshDictionary(String english, String welsh, String wordType) {
@ -39,6 +40,14 @@ public class WelshDictionary {
this.wordType = wordType;
}
public boolean isPracticeWord() {
return practiceWord;
}
public void setPracticeWord(boolean practiceWord) {
this.practiceWord = practiceWord;
}
@Override
public String toString() {
return "WelshDictionary{" +

View file

@ -2,12 +2,10 @@ package org.openjfx.javaFX;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import jsonStuff.JsonProcessing;
import jsonStuff.WelshDictionary;

View file

@ -3,13 +3,12 @@ package org.openjfx.javaFX;
import javafx.animation.*;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.scene.transform.Rotate;
import javafx.util.Duration;
import jsonStuff.WelshDictionary;
import java.util.Stack;
public class PrimaryController {
int index = 0;
@ -24,6 +23,11 @@ public class PrimaryController {
@FXML
private Text testWord;
@FXML
private ImageView left_arrow;
@FXML
private ImageView right_arrow;
@FXML
private void initialize() {
testWord.setText(App.words.getFirst().getWelsh());
@ -31,6 +35,12 @@ public class PrimaryController {
updateCounter();
card = flashcard;
Image left = new Image(getClass().getResource("/assets/docs_ui_spec_presentation_src_img_Icons_icons8-left-50.png").toExternalForm());
Image right = new Image(getClass().getResourceAsStream("/assets/docs_ui_spec_presentation_src_img_Icons_icons8-right-50.png"));
left_arrow.setImage(left);
right_arrow.setImage(right);
}
@FXML

View file

@ -1,43 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.shape.Polygon?>
<?import javafx.scene.image.ImageView?>
<VBox xmlns:fx="http://javafx.com/fxml"
fx:controller="org.openjfx.javaFX.PrimaryController" alignment="center" spacing="10">
stylesheets="@styles.css" fx:controller="org.openjfx.javaFX.PrimaryController" alignment="center" spacing="10">
<padding>
<Insets top="25" right="25" bottom="10" left="25"/>
</padding>
<children>
<StackPane onMouseClicked="#handleFlashcardClick">
<children>
<Rectangle fx:id="flashcard" width="500" height="360" fill="white" arcHeight="80" arcWidth="80"
<Rectangle fx:id="flashcard" width="550" height="360" fill="white" arcHeight="80" arcWidth="80"
stroke="black"/>
<Text textAlignment="CENTER" fx:id="testWord">
<font>
<Font size="50"/>
<Font size="55"/>
</font>
</Text>
<VBox alignment="BOTTOM_CENTER">
<Text fx:id="wordType" fill="dimgray">
<font>
<Font size="15"></Font>
<Font size="20"></Font>
</font>
</Text>
</VBox>
</children>
</StackPane>
<HBox spacing="75" alignment="BASELINE_CENTER">
<HBox spacing="190" alignment="BASELINE_CENTER">
<children>
<Button text="Previous" onAction="#handlePreviousCard"></Button>
<Text fx:id="counter"/>
<Button text="Next" onAction="#handleNextCard"></Button>
<ImageView fx:id="left_arrow" visible="true" onMouseClicked="#handlePreviousCard"></ImageView>
<Text fx:id="counter"><font> <Font size = "20"></Font></font></Text>
<ImageView fx:id="right_arrow" onMouseClicked="#handleNextCard"></ImageView>
</children>
</HBox>
</children>

View file

@ -1,3 +1,7 @@
.button {
-fx-text-fill: blue;
}
#counter {
-fx-text-fill: blue;
}

View file

@ -1,43 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.shape.Polygon?>
<?import javafx.scene.image.ImageView?>
<VBox xmlns:fx="http://javafx.com/fxml"
fx:controller="org.openjfx.javaFX.PrimaryController" alignment="center" spacing="10">
stylesheets="@styles.css" fx:controller="org.openjfx.javaFX.PrimaryController" alignment="center" spacing="10">
<padding>
<Insets top="25" right="25" bottom="10" left="25"/>
</padding>
<children>
<StackPane onMouseClicked="#handleFlashcardClick">
<children>
<Rectangle fx:id="flashcard" width="500" height="360" fill="white" arcHeight="80" arcWidth="80"
<Rectangle fx:id="flashcard" width="550" height="360" fill="white" arcHeight="80" arcWidth="80"
stroke="black"/>
<Text textAlignment="CENTER" fx:id="testWord">
<font>
<Font size="50"/>
<Font size="55"/>
</font>
</Text>
<VBox alignment="BOTTOM_CENTER">
<Text fx:id="wordType" fill="dimgray">
<font>
<Font size="15"></Font>
<Font size="20"></Font>
</font>
</Text>
</VBox>
</children>
</StackPane>
<HBox spacing="75" alignment="BASELINE_CENTER">
<HBox spacing="190" alignment="BASELINE_CENTER">
<children>
<Button text="Previous" onAction="#handlePreviousCard"></Button>
<Text fx:id="counter"/>
<Button text="Next" onAction="#handleNextCard"></Button>
<ImageView fx:id="left_arrow" visible="true" onMouseClicked="#handlePreviousCard"></ImageView>
<Text fx:id="counter"><font> <Font size = "20"></Font></font></Text>
<ImageView fx:id="right_arrow" onMouseClicked="#handleNextCard"></ImageView>
</children>
</HBox>
</children>

View file

@ -1,3 +1,7 @@
.button {
-fx-text-fill: blue;
}
#counter {
-fx-text-fill: blue;
}