回答編集履歴
1
追記 全文
answer
CHANGED
@@ -14,4 +14,50 @@
|
|
14
14
|
```
|
15
15
|

|
16
16
|
|
17
|
-
[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)
|
17
|
+
[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)
|
18
|
+
|
19
|
+
---
|
20
|
+
|
21
|
+
追記 全文
|
22
|
+
|
23
|
+
```Java
|
24
|
+
package main;
|
25
|
+
|
26
|
+
import javafx.application.Application;
|
27
|
+
import javafx.fxml.FXMLLoader;
|
28
|
+
import javafx.scene.Parent;
|
29
|
+
import javafx.scene.Scene;
|
30
|
+
import javafx.stage.Stage;
|
31
|
+
|
32
|
+
public class Main extends Application {
|
33
|
+
public static void main(String[] args) { launch(args); }
|
34
|
+
|
35
|
+
@Override public void start(Stage primaryStage) throws Exception {
|
36
|
+
Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
|
37
|
+
primaryStage.setTitle("Hello World");
|
38
|
+
primaryStage.setScene(new Scene(root, 300, 275));
|
39
|
+
primaryStage.show();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
```xml
|
45
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
46
|
+
|
47
|
+
<?import javafx.scene.layout.BorderPane?>
|
48
|
+
|
49
|
+
|
50
|
+
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
|
51
|
+
prefHeight="400.0" prefWidth="600.0"
|
52
|
+
style="-fx-background-image: url(main/f.png);"
|
53
|
+
xmlns="http://javafx.com/javafx/11.0.1"
|
54
|
+
xmlns:fx="http://javafx.com/fxml/1"
|
55
|
+
fx:controller="ctrl.Control"/>
|
56
|
+
```
|
57
|
+
|
58
|
+
```Java
|
59
|
+
package ctrl;
|
60
|
+
|
61
|
+
public class Control {}
|
62
|
+
```
|
63
|
+

|