1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-12-23 00:43:32 +01:00

Test: Answer style and better layout

This commit is contained in:
Carlos Galindo 2016-06-12 17:01:17 +02:00
parent c83f765c35
commit 5d5e714b5e
Signed by: kauron
GPG key ID: 83E68706DEE119A3
3 changed files with 13 additions and 5 deletions

View file

@ -30,7 +30,7 @@ public class TestController implements Initializable {
@Override @Override
public void initialize(URL url, ResourceBundle resourceBundle) { public void initialize(URL url, ResourceBundle resourceBundle) {
feedback.setVisible(AppConfig.showFeedback); feedback.setVisible(false);
} }
void setList(List<TestItem> list) { void setList(List<TestItem> list) {
@ -51,7 +51,12 @@ public class TestController implements Initializable {
correctAnswer.setVisible(!right); correctAnswer.setVisible(!right);
correctLabel.setVisible(!right); correctLabel.setVisible(!right);
if (!right) errors++; if (!right) {
errors++;
prevAnswer.setStyle("-fx-text-fill: #C40000;");
} else {
prevAnswer.setStyle("-fx-text-fill: #00C400;");
}
// Remove the question from the pool if the question was correctly answered or there is no repetition // Remove the question from the pool if the question was correctly answered or there is no repetition
if (right || !AppConfig.repeatWrong) { if (right || !AppConfig.repeatWrong) {

View file

@ -0,0 +1,3 @@
.answer {
-fx-font-weight: bold;
}

View file

@ -24,7 +24,7 @@
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<VBox minHeight="280.0" minWidth="360.0" spacing="10.0"> <VBox minHeight="280.0" minWidth="360.0" spacing="10.0" GridPane.hgrow="ALWAYS">
<children> <children>
<Label fx:id="question" text="Question" wrapText="true" VBox.vgrow="ALWAYS"> <Label fx:id="question" text="Question" wrapText="true" VBox.vgrow="ALWAYS">
<font> <font>
@ -53,7 +53,7 @@
<Label text="Previous question" /> <Label text="Previous question" />
<Label fx:id="prevQuestion" text="question" GridPane.columnIndex="1" /> <Label fx:id="prevQuestion" text="question" GridPane.columnIndex="1" />
<Label text="Previous answer" GridPane.rowIndex="1" /> <Label text="Previous answer" GridPane.rowIndex="1" />
<Label fx:id="prevAnswer" text="answer" GridPane.columnIndex="1" GridPane.rowIndex="1" /> <Label fx:id="prevAnswer" styleClass="answer" stylesheets="@../css/test.css" text="answer" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label fx:id="correctLabel" text="Correct answer" GridPane.rowIndex="2" /> <Label fx:id="correctLabel" text="Correct answer" GridPane.rowIndex="2" />
<Label fx:id="correctAnswer" text="correct answer" GridPane.columnIndex="1" GridPane.rowIndex="2" /> <Label fx:id="correctAnswer" text="correct answer" GridPane.columnIndex="1" GridPane.rowIndex="2" />
</children> </children>
@ -62,7 +62,7 @@
</HBox> </HBox>
</children> </children>
</VBox> </VBox>
<VBox spacing="10.0" GridPane.columnIndex="1"> <VBox alignment="TOP_RIGHT" spacing="10.0" GridPane.columnIndex="1">
<children> <children>
<Button defaultButton="true" focusTraversable="false" mnemonicParsing="false" onAction="#onNextAction" prefWidth="70.0" text="Next" /> <Button defaultButton="true" focusTraversable="false" mnemonicParsing="false" onAction="#onNextAction" prefWidth="70.0" text="Next" />
<Button cancelButton="true" focusTraversable="false" mnemonicParsing="false" onAction="#onSkipAction" prefWidth="70.0" text="Skip" /> <Button cancelButton="true" focusTraversable="false" mnemonicParsing="false" onAction="#onSkipAction" prefWidth="70.0" text="Skip" />