forked from MasterFlomaster1/JFXCrypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.java
More file actions
96 lines (79 loc) · 3.45 KB
/
Copy pathGUI.java
File metadata and controls
96 lines (79 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package GUI.Main;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.util.Duration;
import java.io.IOException;
public class GUI extends Application {
private static BorderPane borderPane = new BorderPane();
private static Pane pane;
private static VBox menu;
private static TranslateTransition menuTranslation;
@Override
public void start(Stage primaryStage) {
try {
primaryStage.setTitle("SimpleJavaCrypter");
primaryStage.getIcons().add(new Image("/SJC1.png"));
initializePages();
Scene scene = new Scene(new Pane(), 590, 390);
Parent menuBar = FXMLLoader.load(getClass().getResource("/GUI/fxml/MenuBar.fxml"));
borderPane.setTop(menuBar);
pane = new Pane(Pages.HOME_PAGE.getParent());
pane.getStylesheets().add(getClass().getResource("/GUI/css/General.css").toExternalForm());
borderPane.setCenter(pane);
menu = FXMLLoader.load(getClass().getResource("/GUI/fxml/SideMenu.fxml"));
menu.setTranslateX(-200);
menuTranslation = new TranslateTransition(Duration.millis(250), menu);
menuTranslation.setFromX(-400);
menuTranslation.setToX(0);
menu.setOnMouseExited(evt -> {
//bug here
menuTranslation.setRate(-1);
menuTranslation.play();
});
pane.getChildren().add(menu);
scene.setRoot(borderPane);
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
private void initializePages() {
try {
Pages.ABOUT_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/AboutPage.fxml")));
Pages.FILE_ENCRYPTION_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/FileEncryptionPage.fxml")));
Pages.FILE_HASH_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/FileHashPage.fxml")));
Pages.HASH_SUM_CHECKER_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/HashSumCheckerPage.fxml")));
Pages.HOME_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/HomePage.fxml")));
Pages.SETTINGS_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/SettingsPage.fxml")));
Pages.TEXT_ENCRYPTION_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/TextEncryptionPage.fxml")));
Pages.TEXT_HASH_PAGE.setParent(FXMLLoader.load(getClass().getResource("/GUI/fxml/TextHashPage.fxml")));
} catch (IOException e) {
e.printStackTrace();
}
}
public static void updatePageContent(Node nextNode) {
pane.getChildren().set(0, nextNode);
}
public static void hideMenu() {
menuTranslation.setRate(-1);
menuTranslation.play();
}
public static void menuButtonPressed() {
menuTranslation.setRate(1);
menuTranslation.play();
}
public static void main(String[] args) {
launch(args);
}
}