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
91 lines (75 loc) · 3.24 KB
/
Copy pathGUI.java
File metadata and controls
91 lines (75 loc) · 3.24 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
package GUI;
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;
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("MenuBar.fxml"));
borderPane.setTop(menuBar);
pane = new Pane(Pages.HOME_PAGE.getParent());
pane.getStylesheets().add(getClass().getResource("General.css").toExternalForm());
borderPane.setCenter(pane);
menu = FXMLLoader.load(getClass().getResource("SideMenu.fxml"));
// menu.prefHeightProperty().bind(scene.heightProperty());
menu.setTranslateX(-200);
menuTranslation = new TranslateTransition(Duration.millis(250), menu);
menuTranslation.setFromX(-200);
menuTranslation.setToX(0);
menu.setOnMouseExited(evt -> {
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("AboutPage.fxml")));
Pages.FILE_ENCRYPTION_PAGE.setParent(FXMLLoader.load(getClass().getResource("FileEncryptionPage.fxml")));
Pages.FILE_HASH_PAGE.setParent(FXMLLoader.load(getClass().getResource("FileHashPage.fxml")));
Pages.HASH_SUM_CHECKER_PAGE.setParent(FXMLLoader.load(getClass().getResource("HashSumCheckerPage.fxml")));
Pages.HOME_PAGE.setParent(FXMLLoader.load(getClass().getResource("HomePage.fxml")));
Pages.SETTINGS_PAGE.setParent(FXMLLoader.load(getClass().getResource("SettingsPage.fxml")));
Pages.TEXT_ENCRYPTION_PAGE.setParent(FXMLLoader.load(getClass().getResource("TextEncryptionPage.fxml")));
Pages.TEXT_HASH_PAGE.setParent(FXMLLoader.load(getClass().getResource("TextHashPage.fxml")));
} catch (IOException e) {
e.printStackTrace();
}
}
static void updatePageContent(Node nextNode) {
pane.getChildren().set(0, nextNode);
}
static void hideMenu() {
menuTranslation.setRate(-1);
menuTranslation.play();
}
public static void main(String[] args) {
launch(args);
}
}