-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDescriptionWindow.java
55 lines (48 loc) · 1.49 KB
/
DescriptionWindow.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
/**
* This class construct the window of description of the graph,
* display the image of description.
*
* @Author: Junxiang Chen
* @RegistrationNumber: 180127586
* @Email: jchen115@sheffield.ac.uk
*/
/*
import dependencies
*/
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
/**
* DescriptionWindow class
*/
public class DescriptionWindow extends Stage {
/**
* the constructor function
*/
public DescriptionWindow() {
int width = 720;
int height = 405;
// instantiate a pane
StackPane descriptionPane = new StackPane();
// load an image
Image image = new Image("banner-sample.png", true);
// instantiate an ImageView object and set image
ImageView imageView = new ImageView();
imageView.setImage(image);
// set flexible resizing property
imageView.fitWidthProperty().bind(this.widthProperty());
imageView.fitHeightProperty().bind(this.heightProperty());
// preserve image ratio
imageView.setPreserveRatio(true);
// add component to the pane
descriptionPane.getChildren().add(imageView);
// construct a scene and add pane
Scene thirdScene = new Scene(descriptionPane, width, height);
// set window title
this.setTitle("Description (User Guide) of Diagram");
// set scene
this.setScene(thirdScene);
}
}