Commit 81c2f951 authored by Olaf Rosendahl's avatar Olaf Rosendahl 💻
Browse files

Add key press events

parent e00c7635
Pipeline #81059 passed with stage
in 21 seconds
package Components;
import Css.Css;
import Main.ApplicationManager;
import javafx.scene.control.Button;
import Css.Css;
/**
* Utility class that is used to create confirmations boxes
......@@ -17,28 +17,28 @@ public final class ConfirmationBox {
throw new IllegalStateException("Utility class");
}
/**
* Creates the confirmation box and displays it
* @param title the title of the conformation box
* @param message the massage that the confirmation box is going to display
* @return the answer of the confirmation box
*/
public static boolean display(String title, String message){
PopupWindow dialogWindow = new PopupWindow(ApplicationManager.getStage(), 250,150);
dialogWindow.getDialogWindow().close();
Button yesButton = new Button("Yes");
Button noButton = new Button("No");
yesButton.setOnAction(s -> {
answer = true;
dialogWindow.getDialogWindow().close();
});
noButton.setOnAction(s -> {
answer = false;
dialogWindow.getDialogWindow().close();
});
/**
* Creates the confirmation box and displays it
*
* @param title the title of the conformation box
* @param message the massage that the confirmation box is going to display
* @return the answer of the confirmation box
*/
public static boolean display(String title, String message) {
PopupWindow dialogWindow = new PopupWindow(ApplicationManager.getStage(), 250, 150);
dialogWindow.getDialogWindow().close();
Button yesButton = new Button("Yes");
Button noButton = new Button("No");
yesButton.setOnAction(s -> {
answer = true;
dialogWindow.getDialogWindow().close();
});
noButton.setCancelButton(true);
noButton.setOnAction(s -> {
answer = false;
dialogWindow.getDialogWindow().close();
});
Css.setButton(150,30,15,yesButton,noButton);
......
......@@ -64,6 +64,7 @@ public final class PhotoViewer {
Button addTagButton = new Button("Add tag");
Button closeButton = new Button("Close");
closeButton.setCancelButton(true);
Css.setButton(582, 25, 20, addTagButton, closeButton);
AnchorPane layout = new AnchorPane();
......
......@@ -62,6 +62,7 @@ public final class LoginRoot extends SceneRoot {
Css.setLoadingAnimation(LOADING_ANIMATION);
//Sets functionality for the layout components
LOG_IN_BUTTON.setDefaultButton(true);
LOG_IN_BUTTON.setOnAction(e -> login());
SIGN_UP_BUTTON.setOnAction(e -> ApplicationManager.setRoot(new SignUpRoot()));
}
......
......@@ -72,6 +72,7 @@ final class SignUpRoot extends SceneRoot {
Css.setLabel(13, USERNAME_LABEL, PASSWORD_LABEL, CONFIRM_PASSWORD_LABEL);
Css.setLoadingAnimation(LOADING_ANIMATION);
SIGN_UP_BUTTON.setDefaultButton(true);
SIGN_UP_BUTTON.setOnAction(e -> signUp());
PASSWORD_FIELD.setOnKeyTyped(e -> passwordStrengthBarEventHandling());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment