-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathProblem$01.java
57 lines (46 loc) · 1.38 KB
/
Problem$01.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
package chapter_fourteen;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
/**
* *14.1 (Display images) Write a program that displays four images in a grid pane, as
* shown in Figure 14.43a.
*
* @author Sharaf Qeshta
* */
public class Problem$01 extends Application
{
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage primaryStage)
{
GridPane pane = new GridPane();
pane.setHgap(5);
pane.setVgap(5);
ImageView us = new ImageView("chapter_fourteen/us.jpg");
ImageView uk = new ImageView("chapter_fourteen/uk.png");
ImageView ca = new ImageView("chapter_fourteen/ca.png");
ImageView ch = new ImageView("chapter_fourteen/ch.png");
us.setFitWidth(250);
us.setFitHeight(250);
uk.setFitWidth(250);
uk.setFitHeight(250);
ca.setFitWidth(250);
ca.setFitHeight(250);
ch.setFitWidth(250);
ch.setFitHeight(250);
pane.add(uk, 0, 0);
pane.add(ca, 1, 0);
pane.add(us, 1, 1);
pane.add(ch, 0, 1);
Scene scene = new Scene(pane, 500, 500);
primaryStage.setTitle("Problem$01");
primaryStage.setScene(scene);
primaryStage.show();
}
}