回答編集履歴

1

追記 全文

2022/01/03 05:38

投稿

TN8001
TN8001

スコア9862

test CHANGED
@@ -31,3 +31,95 @@
31
31
 
32
32
 
33
33
  [Correct way to set the path of a BackgroundImage in JavaFX CSS - Stack Overflow](https://stackoverflow.com/questions/16630487/correct-way-to-set-the-path-of-a-backgroundimage-in-javafx-css)
34
+
35
+
36
+
37
+ ---
38
+
39
+
40
+
41
+ 追記 全文
42
+
43
+
44
+
45
+ ```Java
46
+
47
+ package main;
48
+
49
+
50
+
51
+ import javafx.application.Application;
52
+
53
+ import javafx.fxml.FXMLLoader;
54
+
55
+ import javafx.scene.Parent;
56
+
57
+ import javafx.scene.Scene;
58
+
59
+ import javafx.stage.Stage;
60
+
61
+
62
+
63
+ public class Main extends Application {
64
+
65
+ public static void main(String[] args) { launch(args); }
66
+
67
+
68
+
69
+ @Override public void start(Stage primaryStage) throws Exception {
70
+
71
+ Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
72
+
73
+ primaryStage.setTitle("Hello World");
74
+
75
+ primaryStage.setScene(new Scene(root, 300, 275));
76
+
77
+ primaryStage.show();
78
+
79
+ }
80
+
81
+ }
82
+
83
+ ```
84
+
85
+
86
+
87
+ ```xml
88
+
89
+ <?xml version="1.0" encoding="UTF-8"?>
90
+
91
+
92
+
93
+ <?import javafx.scene.layout.BorderPane?>
94
+
95
+
96
+
97
+
98
+
99
+ <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
100
+
101
+ prefHeight="400.0" prefWidth="600.0"
102
+
103
+ style="-fx-background-image: url(main/f.png);"
104
+
105
+ xmlns="http://javafx.com/javafx/11.0.1"
106
+
107
+ xmlns:fx="http://javafx.com/fxml/1"
108
+
109
+ fx:controller="ctrl.Control"/>
110
+
111
+ ```
112
+
113
+
114
+
115
+ ```Java
116
+
117
+ package ctrl;
118
+
119
+
120
+
121
+ public class Control {}
122
+
123
+ ```
124
+
125
+ ![確認画像](660113e988914fa578d4637f00f414a3.png)