-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.java
81 lines (67 loc) · 1.66 KB
/
demo.java
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
import javafx.application.*;
import javafx.stage.*;
import javafx.scene.*;
import javafx.geometry.*;
import javafx.event.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.scene.text.*;
/**
* This class is for main class of the project
* It generate the first GUI window of the project
* This class is written in Javafx
*/
public class demo extends Application
{
BorderPane borderPane = new BorderPane ();
public void start (Stage primaryStage)
{ /**
* Creating Object of Text Type and setting its properties
*/
Text Q = new Text("Select file type..");
Q.setFont(Font.font("New Times Roman",FontWeight.BOLD,20));
/**
* Creating Object of HBox Type
*/
HBox hbox = new HBox(10);
hbox.setAlignment(Pos.CENTER);
/**
* Creating Object of Buttons
*/
Button b1 = new Button("Image.img");
Button b2 = new Button("Text.txt");
/**
* Functioning of the Image Button
*/
b1.setOnAction(event->{
borderPane.setCenter(new demoone(primaryStage).gridPane);
});
/**
* Functioning of the Text Button
*/
b2.setOnAction(event->{
borderPane.setCenter(new demotwo(primaryStage).gridPane);
});
/**
* Adding both the button on the HBox
*/
hbox.getChildren().addAll(b1,b2);
/**
* Setting Text and HBox on the Border Pane
*/
borderPane.setTop(Q);
borderPane.setCenter(hbox);
/**
* Setting Background Color
*/
borderPane.setStyle("-fx-background-color:#D7ECFD;");
/**
* Creating Scene object
*/
Scene scene = new Scene (borderPane, 500, 500);
primaryStage.setScene (scene);
primaryStage.show ();
}
}