Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions LoginWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@

<AnchorPane id="AnchorPane" prefHeight="480.0" prefWidth="600.0" style="-fx-background-color: #eaebed;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="flashcards.LoginWindowController">
<children>
<Label layoutX="221.0" layoutY="97.0" text="Please Login or Register" >
<Label layoutX="180.0" layoutY="97.0" text="Please Login or Register" >
<font>
<Font size="20.0" />
<Font size="25.0" />
</font>
</Label>
<TextField id="userField" fx:id="userField" layoutX="193.0" layoutY="199.0" prefHeight="31.0" prefWidth="215.0" />
<Label layoutX="267.0" layoutY="169.0" text="Username" >
<Label layoutX="240.0" layoutY="169.0" text="Username" >
<font>
<Font size="20.0" />
<Font size="23.0" />
</font>
</Label>
<TextField id="passField" fx:id="passField" layoutX="193.0" layoutY="288.0" prefHeight="31.0" prefWidth="215.0" />
<Label layoutX="269.0" layoutY="257.0" text="Password" >
<Label layoutX="240.0" layoutY="257.0" text="Password" >
<font>
<Font size="20.0" />
<Font size="23.0" />
</font>
</Label>
<Button layoutX="137.0" layoutY="375.0" mnemonicParsing="false" onAction="#handleLogin" prefHeight="31.0" prefWidth="92.0" text="Login" />
Expand Down
4 changes: 1 addition & 3 deletions Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ public static void main(String[] args) {
launch(args);
}

// test existing model classes with temporary console interface driver
//ProgramDriver.testProgramWithConsoleInterface();
//System.exit(0); // required to exit when there is no GUI exit

}

}
52 changes: 38 additions & 14 deletions MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<?import javafx.geometry.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.text.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
Expand All @@ -10,13 +11,21 @@

<AnchorPane id="AnchorPane" prefHeight="720.0" prefWidth="961.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="flashcards.MainWindowController">
<children>
<Label fx:id="welcomeLabel" layoutX="96.0" layoutY="30.0" text="Welcome, User!" />
<Label layoutX="96.0" layoutY="66.0" text="Select a Subject" />
<Button alignment="CENTER" layoutX="73.0" layoutY="582.0" mnemonicParsing="false" onAction="#createNewSubjectBtn" prefHeight="31.0" prefWidth="152.0" text="Add Subject" />
<Label fx:id="welcomeLabel" layoutX="50.0" layoutY="30.0" text="Welcome, User!">
<font>
<Font size="26.0" />
</font>
</Label>
<Label layoutX="50.0" layoutY="66.0" text="Select a Subject" >
<font>
<Font size="26.0" />
</font>
</Label>
<Button alignment="CENTER" layoutX="73.0" layoutY="582.0" mnemonicParsing="false" onAction="#createNewSubjectBtn" prefHeight="31.0" prefWidth="180.0" text="Add Subject" />
<Separator layoutX="309.0" layoutY="41.0" orientation="VERTICAL" prefHeight="632.0" prefWidth="6.0" />
<ListView fx:id="listView" layoutX="49.0" layoutY="101.0" prefHeight="428.0" prefWidth="200.0" />
<Button alignment="CENTER" layoutX="72.0" layoutY="544.0" mnemonicParsing="false" onAction="#addFlashCardBtn" prefHeight="31.0" prefWidth="152.0" text="Add FlashCard" />
<BorderPane fx:id="flashcardPane" layoutX="344.0" layoutY="31.0" prefHeight="658.0" prefWidth="581.0">
<Button alignment="CENTER" layoutX="72.0" layoutY="544.0" mnemonicParsing="false" onAction="#addFlashCardBtn" prefHeight="31.0" prefWidth="180.0" text="Add FlashCard" />
<BorderPane fx:id="flashcardPane" layoutX="344.0" layoutY="31.0" prefHeight="800.0" prefWidth="890.0">
<left>
<Button alignment="CENTER" mnemonicParsing="false" onAction="#prevCardBtn" prefHeight="31.0" prefWidth="76.0" text="Previous" BorderPane.alignment="CENTER" />
</left>
Expand All @@ -25,8 +34,11 @@
<opaqueInsets>
<Insets />
</opaqueInsets>
<font>
<Font size="24.0" />
</font>
<BorderPane.margin>
<Insets />
<Insets />
</BorderPane.margin>
</Label>
</top>
Expand All @@ -36,25 +48,37 @@
<bottom>
<VBox alignment="BOTTOM_CENTER" prefHeight="137.0" prefWidth="585.0" spacing="5.0" BorderPane.alignment="CENTER">
<children>
<Label fx:id="totAttemptLabel" text="Total Attempts: 0" />
<Label fx:id="corAttemptLabel" alignment="CENTER" text="Correct Attempts: 0" />
<Label fx:id="incAttemptLabel" alignment="CENTER" text="Incorrect Attempts: 0" />
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#removeFlashcardBtn" prefHeight="31.0" prefWidth="152.0" text="Remove FlashCard" />
<Label fx:id="totAttemptLabel" text="Total Attempts: 0" >
<font>
<Font size="30.0" />
</font>
</Label>
<Label fx:id="corAttemptLabel" alignment="CENTER" text="Correct Attempts: 0" >
<font>
<Font size="30.0" />
</font>
</Label>
<Label fx:id="incAttemptLabel" alignment="CENTER" text="Incorrect Attempts: 0" >
<font>
<Font size="30.0" />
</font>
</Label>
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#removeFlashcardBtn" prefHeight="31.0" prefWidth="170.0" text="Remove FlashCard" />
</children>
</VBox>
</bottom>
<center>
<VBox fx:id="flashcardDisplayBox" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0" spacing="15.0" BorderPane.alignment="CENTER">
<VBox fx:id="flashcardDisplayBox" alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0" spacing="30.0" BorderPane.alignment="CENTER">
<children>
<Label text="Label" />
<TextField alignment="CENTER" prefHeight="31.0" prefWidth="357.0" />
<TextField alignment="CENTER" prefHeight="31.0" prefWidth="300.0" />
<Button mnemonicParsing="false" text="Check Answer" />
</children>
<padding>
<Insets left="40.0" right="40.0" top="10.0" />
</padding></VBox>
</center></BorderPane>
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="73.0" layoutY="620.0" mnemonicParsing="false" onAction="#removeSubjectBtn" prefHeight="31.0" prefWidth="152.0" text="Remove Subject" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="72.0" layoutY="658.0" mnemonicParsing="false" onAction="#resetFlashcardsBtn" prefHeight="31.0" prefWidth="152.0" text="Reset FlashCards" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="73.0" layoutY="620.0" mnemonicParsing="false" onAction="#removeSubjectBtn" prefHeight="31.0" prefWidth="180.0" text="Remove Subject" />
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="72.0" layoutY="658.0" mnemonicParsing="false" onAction="#resetFlashcardsBtn" prefHeight="31.0" prefWidth="180.0" text="Reset FlashCards" />
</children>
</AnchorPane>
4 changes: 3 additions & 1 deletion MainWindowController.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Pos;
import javafx.scene.text.Font;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
Expand Down Expand Up @@ -286,10 +287,11 @@ private void clearCards()
// Helper method
private VBox buildFlashCard(FlashCard card) {
flashcardDisplayBox = new VBox(15); // spacing between children
flashcardDisplayBox.setPadding(new Insets(100, 50, 180, 50));
flashcardDisplayBox.setPadding(new Insets(100, 50, 180, 100));
flashcardDisplayBox.setAlignment(Pos.CENTER);

Label question = new Label(card.getQuestion());
question.setFont(Font.font("Verdana",24)); // make the font bigger so users can read it easily
TextField answer = new TextField();
Button checkBtn = new Button("Check Answer");
checkBtn.setOnAction((ActionEvent event) ->
Expand Down