fixed a bit of stuff
|  | @ -4,17 +4,19 @@ public class Account { | |||
|     private String name; | ||||
|     private String surname; | ||||
|     private String email; | ||||
|     private String password; | ||||
|     private String phone; | ||||
|     private String street; | ||||
|     private String city; | ||||
|     private String cityCode; | ||||
| 
 | ||||
|     // Getters and setters for all fields | ||||
|     public Account(String name, String surname, String email, String phone, String street, String city, | ||||
|     public Account(String name, String surname, String email, String password, String phone, String street, String city, | ||||
|             String cityCode) { | ||||
|         this.name = name; | ||||
|         this.surname = surname; | ||||
|         this.email = email; | ||||
|         this.password = password; | ||||
|         this.phone = phone; | ||||
|         this.street = street; | ||||
|         this.city = city; | ||||
|  | @ -45,6 +47,14 @@ public class Account { | |||
|         this.email = email; | ||||
|     } | ||||
| 
 | ||||
|     public String getPassword() { | ||||
|         return password; | ||||
|     } | ||||
| 
 | ||||
|     public void setPassword(String password) { | ||||
|         this.password = password; | ||||
|     } | ||||
| 
 | ||||
|     public String getPhone() { | ||||
|         return phone; | ||||
|     } | ||||
|  |  | |||
|  | @ -14,6 +14,7 @@ import java.util.Objects; | |||
| public class App extends Application { | ||||
| 
 | ||||
|     private static Scene scene; | ||||
|     public static Account account; | ||||
| 
 | ||||
|     @Override | ||||
|     public void start(Stage stage) throws IOException { | ||||
|  |  | |||
|  | @ -4,7 +4,10 @@ import java.io.IOException; | |||
| 
 | ||||
| import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | ||||
| import javafx.scene.control.Alert; | ||||
| import javafx.scene.control.Alert.AlertType; | ||||
| import javafx.scene.control.Button; | ||||
| import javafx.scene.control.ButtonType; | ||||
| import javafx.scene.control.Label; | ||||
| import javafx.scene.control.PasswordField; | ||||
| import javafx.scene.control.TextField; | ||||
|  | @ -132,20 +135,22 @@ public class LoginController { | |||
|     } | ||||
| 
 | ||||
|     @FXML | ||||
|     private void handleLoginButtonClick(MouseEvent event) { | ||||
|     private void handleLoginButtonClick(ActionEvent event) throws IOException { | ||||
|         String username = usernameInput.getText(); | ||||
|         String password = passwordInput.getText(); | ||||
| 
 | ||||
|         if (validateCredentials(username, password)) { | ||||
|             System.out.println("Login successful!"); | ||||
|             // Navigate to the main page or user dashboard | ||||
|             Alert alert = new Alert(AlertType.INFORMATION, "Login Successful.", ButtonType.OK); | ||||
|             alert.showAndWait(); | ||||
|             App.setRoot("shop"); | ||||
|         } else { | ||||
|             System.out.println("Invalid username or password."); | ||||
|             Alert alert = new Alert(AlertType.INFORMATION, "Account created.", ButtonType.OK); | ||||
|             alert.showAndWait(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private boolean validateCredentials(String username, String password) { | ||||
|         // Replace this with actual authentication logic | ||||
|         return "user".equals(username) && "password".equals(password); | ||||
|         return App.account.getEmail().equals(username) && App.account.getPassword().equals(password); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -2,50 +2,151 @@ package com.example; | |||
| 
 | ||||
| import java.io.IOException; | ||||
| 
 | ||||
| import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | ||||
| import javafx.scene.control.Alert; | ||||
| import javafx.scene.control.Button; | ||||
| import javafx.scene.control.ButtonType; | ||||
| import javafx.scene.control.Label; | ||||
| import javafx.scene.control.TextField; | ||||
| import javafx.scene.control.Alert.AlertType; | ||||
| import javafx.scene.input.MouseEvent; | ||||
| import javafx.scene.layout.GridPane; | ||||
| import javafx.scene.layout.HBox; | ||||
| import javafx.scene.layout.Pane; | ||||
| import javafx.scene.layout.VBox; | ||||
| 
 | ||||
| public class RegisterController { | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label mainTitle; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Button cartBtn; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Button loginBtn; | ||||
|     private TextField cityCodeInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField nameInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField surnameInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField emailInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField phoneInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField streetInput; | ||||
|     private Label cityCodeLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField cityInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField cityCodeInput; | ||||
|     private Label cityLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     private VBox contactUs; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Button createAccountButton; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField emailInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label emailLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     private VBox followUs; | ||||
| 
 | ||||
|     @FXML | ||||
|     private VBox footer; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerAbout; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerBluesky; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerContact; | ||||
| 
 | ||||
|     @FXML | ||||
|     private VBox footerCopy; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerCopyText; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerEmail; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerFacebook; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerHeading2; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerHeading3; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerHome; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerInstagram; | ||||
| 
 | ||||
|     @FXML | ||||
|     private HBox footerLinks; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerPhone; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label footerText; | ||||
| 
 | ||||
|     @FXML | ||||
|     private VBox formFields; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label formTitle; | ||||
| 
 | ||||
|     @FXML | ||||
|     private HBox header; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Button loginBtn; | ||||
| 
 | ||||
|     @FXML | ||||
|     private GridPane mainGrid; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label mainTitle; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField nameInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label nameLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField passwordInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label passwordLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField phoneInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label phoneLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     private VBox quickLinks; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Pane spacerPane; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField streetInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label streetLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     private TextField surnameInput; | ||||
| 
 | ||||
|     @FXML | ||||
|     private Label surnameLabel; | ||||
| 
 | ||||
|     @FXML | ||||
|     void handleTitleClick(MouseEvent event) throws IOException { | ||||
|         App.setRoot("shop"); | ||||
|  | @ -62,31 +163,33 @@ public class RegisterController { | |||
|     } | ||||
| 
 | ||||
|     @FXML | ||||
|     private void handleCreateAccountButtonClick(MouseEvent event) { | ||||
|     private void handleCreateAccountButtonClick(ActionEvent event) throws IOException { | ||||
|         String name = nameInput.getText(); | ||||
|         String surname = surnameInput.getText(); | ||||
|         String email = emailInput.getText(); | ||||
|         String password = passwordInput.getText(); | ||||
|         String phone = phoneInput.getText(); | ||||
|         String street = streetInput.getText(); | ||||
|         String city = cityInput.getText(); | ||||
|         String cityCode = cityCodeInput.getText(); | ||||
| 
 | ||||
|         if (validateForm(name, surname, email, phone, street, city, cityCode)) { | ||||
|             System.out.println("Account created successfully!"); | ||||
|             System.out.println("Name: " + name + " " + surname); | ||||
|             System.out.println("Email: " + email); | ||||
|             System.out.println("Phone: " + phone); | ||||
|             System.out.println("Address: " + street + ", " + city + " - " + cityCode); | ||||
|             // Add logic to save user data or navigate to a new page | ||||
|         if (validateForm(name, surname, email, password, phone, street, city, cityCode)) { | ||||
|             App.account = new Account(name, surname, email, password, phone, street, city, cityCode); | ||||
|             Alert alert = new Alert(AlertType.INFORMATION, "Account created.", ButtonType.OK); | ||||
|             alert.showAndWait(); | ||||
|             App.setRoot("login"); | ||||
|         } else { | ||||
|             System.out.println("Please fill in all the fields correctly."); | ||||
|             Alert alert = new Alert(AlertType.ERROR, "You have to fill all fields!", ButtonType.OK); | ||||
|             alert.showAndWait(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private boolean validateForm(String name, String surname, String email, String phone, String street, String city, | ||||
|     private boolean validateForm(String name, String surname, String email, String password, String phone, | ||||
|             String street, String city, | ||||
|             String cityCode) { | ||||
|         // Basic validation to ensure no fields are empty | ||||
|         return !(name.isEmpty() || surname.isEmpty() || email.isEmpty() || phone.isEmpty() || street.isEmpty() | ||||
|         return !(name.isEmpty() || surname.isEmpty() || email.isEmpty() || password.isEmpty() || phone.isEmpty() | ||||
|                 || street.isEmpty() | ||||
|                 || city.isEmpty() || cityCode.isEmpty()); | ||||
|     } | ||||
| } | ||||
|  |  | |||
| Before Width: | Height: | Size: 493 KiB | 
| After Width: | Height: | Size: 6 MiB | 
| Before Width: | Height: | Size: 316 KiB | 
| After Width: | Height: | Size: 1.9 MiB | 
| Before Width: | Height: | Size: 382 KiB | 
| After Width: | Height: | Size: 2.5 MiB | 
| Before Width: | Height: | Size: 659 KiB | 
| After Width: | Height: | Size: 3.4 MiB | 
| Before Width: | Height: | Size: 107 KiB | 
| After Width: | Height: | Size: 701 KiB | 
| Before Width: | Height: | Size: 1.3 MiB | 
| After Width: | Height: | Size: 7.6 MiB | 
| Before Width: | Height: | Size: 244 KiB | 
| After Width: | Height: | Size: 2.5 MiB | 
| Before Width: | Height: | Size: 234 KiB | 
| After Width: | Height: | Size: 1.8 MiB | 
| Before Width: | Height: | Size: 128 KiB | 
| After Width: | Height: | Size: 992 KiB | 
|  | @ -86,7 +86,7 @@ | |||
|                   <VBox fx:id="formFields" spacing="15.0"> | ||||
|                      <!-- Username Field --> | ||||
|                      <VBox spacing="5.0"> | ||||
|                         <Label fx:id="usernameLabel" styleClass="formLabel" text="Username" /> | ||||
|                         <Label fx:id="usernameLabel" styleClass="formLabel" text="E-Mail" /> | ||||
|                         <TextField fx:id="usernameInput" styleClass="formInput" /> | ||||
|                      </VBox> | ||||
|                      <!-- Password Field --> | ||||
|  |  | |||
|  | @ -57,6 +57,8 @@ | |||
|                    | ||||
|                   <Label id="emailLabel" fx:id="emailLabel" styleClass="formLabel" text="Email address" /> | ||||
|                   <TextField id="emailInput" fx:id="emailInput" styleClass="formInput" /> | ||||
|                   <Label id="emailLabel" fx:id="passwordLabel" styleClass="formLabel" text="Password" /> | ||||
|                   <TextField id="emailInput" fx:id="passwordInput" styleClass="formInput" /> | ||||
|                    | ||||
|                   <Label id="phoneLabel" fx:id="phoneLabel" styleClass="formLabel" text="Phone number" /> | ||||
|                   <TextField id="phoneInput" fx:id="phoneInput" styleClass="formInput" /> | ||||
|  | @ -71,7 +73,7 @@ | |||
|                   <TextField id="cityCodeInput" fx:id="cityCodeInput" styleClass="formInput" /> | ||||
|                </children> | ||||
|             </VBox> | ||||
|             <Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" /> | ||||
|             <Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" onAction="#handleCreateAccountButtonClick" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" /> | ||||
|          </children> | ||||
|       </GridPane> | ||||
|    </center> | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|   -fx-padding: 20; | ||||
|   -fx-hgap: 20; | ||||
|   -fx-vgap: 20; | ||||
|   -fx-background-image: url("images/background"); | ||||
|   -fx-background-image: url("images/background.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-position: center center; | ||||
|   -fx-background-blend-mode: overlay; | ||||
|  | @ -98,35 +98,35 @@ | |||
| } | ||||
| 
 | ||||
| #cardDiv1 { | ||||
|   -fx-background-image: url("images/lotr.jpg"); | ||||
|   -fx-background-image: url("images/lotr.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv2 { | ||||
|   -fx-background-image: url("images/wheel.jpg"); | ||||
|   -fx-background-image: url("images/wheel.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv3 { | ||||
|   -fx-background-image: url("images/narnia.jpg"); | ||||
|   -fx-background-image: url("images/narnia.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv4 { | ||||
|   -fx-background-image: url("images/earthsea.jpg"); | ||||
|   -fx-background-image: url("images/earthsea.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv5 { | ||||
|   -fx-background-image: url("images/theFirstLaw.jpg"); | ||||
|   -fx-background-image: url("images/theFirstLaw.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
|  | @ -140,14 +140,14 @@ | |||
| } | ||||
| 
 | ||||
| #cardDiv7 { | ||||
|   -fx-background-image: url("images/mistborn.jpg"); | ||||
|   -fx-background-image: url("images/mistborn.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv8 { | ||||
|   -fx-background-image: url("images/stormlight.jpg"); | ||||
|   -fx-background-image: url("images/stormlight.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
|  |  | |||
| Before Width: | Height: | Size: 493 KiB | 
| After Width: | Height: | Size: 6 MiB | 
| Before Width: | Height: | Size: 316 KiB | 
| After Width: | Height: | Size: 1.9 MiB | 
| Before Width: | Height: | Size: 382 KiB | 
| After Width: | Height: | Size: 2.5 MiB | 
| Before Width: | Height: | Size: 659 KiB | 
| After Width: | Height: | Size: 3.4 MiB | 
| Before Width: | Height: | Size: 107 KiB | 
| After Width: | Height: | Size: 701 KiB | 
| Before Width: | Height: | Size: 1.3 MiB | 
| After Width: | Height: | Size: 7.6 MiB | 
| Before Width: | Height: | Size: 244 KiB | 
| After Width: | Height: | Size: 2.5 MiB | 
| Before Width: | Height: | Size: 234 KiB | 
| After Width: | Height: | Size: 1.8 MiB | 
| Before Width: | Height: | Size: 128 KiB | 
| After Width: | Height: | Size: 992 KiB | 
|  | @ -86,7 +86,7 @@ | |||
|                   <VBox fx:id="formFields" spacing="15.0"> | ||||
|                      <!-- Username Field --> | ||||
|                      <VBox spacing="5.0"> | ||||
|                         <Label fx:id="usernameLabel" styleClass="formLabel" text="Username" /> | ||||
|                         <Label fx:id="usernameLabel" styleClass="formLabel" text="E-Mail" /> | ||||
|                         <TextField fx:id="usernameInput" styleClass="formInput" /> | ||||
|                      </VBox> | ||||
|                      <!-- Password Field --> | ||||
|  |  | |||
|  | @ -57,6 +57,8 @@ | |||
|                    | ||||
|                   <Label id="emailLabel" fx:id="emailLabel" styleClass="formLabel" text="Email address" /> | ||||
|                   <TextField id="emailInput" fx:id="emailInput" styleClass="formInput" /> | ||||
|                   <Label id="emailLabel" fx:id="passwordLabel" styleClass="formLabel" text="Password" /> | ||||
|                   <TextField id="emailInput" fx:id="passwordInput" styleClass="formInput" /> | ||||
|                    | ||||
|                   <Label id="phoneLabel" fx:id="phoneLabel" styleClass="formLabel" text="Phone number" /> | ||||
|                   <TextField id="phoneInput" fx:id="phoneInput" styleClass="formInput" /> | ||||
|  | @ -71,7 +73,7 @@ | |||
|                   <TextField id="cityCodeInput" fx:id="cityCodeInput" styleClass="formInput" /> | ||||
|                </children> | ||||
|             </VBox> | ||||
|             <Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" /> | ||||
|             <Button id="createAccountButton" fx:id="createAccountButton" mnemonicParsing="false" onAction="#handleCreateAccountButtonClick" styleClass="btnCreateAccount" text="Create account" GridPane.rowIndex="3" /> | ||||
|          </children> | ||||
|       </GridPane> | ||||
|    </center> | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|   -fx-padding: 20; | ||||
|   -fx-hgap: 20; | ||||
|   -fx-vgap: 20; | ||||
|   -fx-background-image: url("images/background"); | ||||
|   -fx-background-image: url("images/background.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-position: center center; | ||||
|   -fx-background-blend-mode: overlay; | ||||
|  | @ -98,35 +98,35 @@ | |||
| } | ||||
| 
 | ||||
| #cardDiv1 { | ||||
|   -fx-background-image: url("images/lotr.jpg"); | ||||
|   -fx-background-image: url("images/lotr.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv2 { | ||||
|   -fx-background-image: url("images/wheel.jpg"); | ||||
|   -fx-background-image: url("images/wheel.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv3 { | ||||
|   -fx-background-image: url("images/narnia.jpg"); | ||||
|   -fx-background-image: url("images/narnia.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv4 { | ||||
|   -fx-background-image: url("images/earthsea.jpg"); | ||||
|   -fx-background-image: url("images/earthsea.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv5 { | ||||
|   -fx-background-image: url("images/theFirstLaw.jpg"); | ||||
|   -fx-background-image: url("images/theFirstLaw.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
|  | @ -140,14 +140,14 @@ | |||
| } | ||||
| 
 | ||||
| #cardDiv7 { | ||||
|   -fx-background-image: url("images/mistborn.jpg"); | ||||
|   -fx-background-image: url("images/mistborn.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
| } | ||||
| 
 | ||||
| #cardDiv8 { | ||||
|   -fx-background-image: url("images/stormlight.jpg"); | ||||
|   -fx-background-image: url("images/stormlight.png"); | ||||
|   -fx-background-size: cover; | ||||
|   -fx-background-repeat: no-repeat; | ||||
|   -fx-background-position: center; | ||||
|  |  | |||