質問編集履歴
2
codeの追加(一部省略しています)
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
javaFXのloadで、例外が起きました。
|
2
|
-
|
3
1
|
javafxを初めて使って、とりあえず何か作ってみようと思って実行してみると、Label is not a valid type.とエラーが出ました。そこで調べてみると、Labelがimportされていないようだったので、importして実行してみると、今度は、ClassMotFoundExeptionが出てしまいまい、調べても英語の記事ばっかりで挫折してしまいました…
|
4
2
|
何のクラスが見つからないのか、どうやったら治せるか教えてください!
|
5
3
|
あと、fxmlではjavafx.scene.layout.*で、すべてのlayoutをimportしているはずなのに何故もう一回importしないといけないのかも教えていただけると嬉しいです!
|
@@ -8,14 +6,12 @@
|
|
8
6
|
|
9
7
|
```
|
10
8
|
javafx.fxml.LoadException:
|
11
|
-
/C:/
|
9
|
+
/C:/zip-of-java/pleiades-2020-12-java-win-64bit-jre_20201222/pleiades/workspace/FXPractice/bin/application/ScheduleTable.fxml
|
12
10
|
|
13
11
|
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
|
14
12
|
at javafx.fxml/javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2863)
|
15
13
|
at javafx.fxml/javafx.fxml.FXMLLoader.processImport(FXMLLoader.java:2707)
|
16
14
|
at javafx.fxml/javafx.fxml.FXMLLoader.processProcessingInstruction(FXMLLoader.java:2676)
|
17
|
-
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2542)
|
18
|
-
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
|
19
15
|
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
|
20
16
|
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
|
21
17
|
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
|
@@ -44,17 +40,121 @@
|
|
44
40
|
|
45
41
|
### 該当のソースコード
|
46
42
|
|
47
|
-
```
|
48
|
-
|
43
|
+
```java
|
44
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
45
|
+
|
46
|
+
|
47
|
+
<?import javafx.geometry.*?>
|
48
|
+
<?import javafx.scene.control.*?>
|
49
|
+
<?import javafx.scene.layout.*?>
|
50
|
+
<?import javafx.scene.layout.HBox?>
|
51
|
+
<?import javafx.scene.layout.Label?>
|
52
|
+
|
53
|
+
<HBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" xmlns:controller="/FXPractice/src/application/PleaseProvideControllerClassName.java">
|
54
|
+
<children>
|
55
|
+
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="700.0" prefWidth="100.0">
|
56
|
+
<children>
|
57
|
+
<AnchorPane prefHeight="74.0" prefWidth="100.0">
|
58
|
+
<children>
|
59
|
+
<Label layoutX="8.0" layoutY="6.0" prefHeight="17.0" prefWidth="36.0" text="Date" AnchorPane.leftAnchor="8.0" AnchorPane.topAnchor="6.0" />
|
60
|
+
<CheckBox layoutX="25.0" layoutY="22.0" mnemonicParsing="false" text="CheckBox" AnchorPane.rightAnchor="1.0">
|
61
|
+
<padding>
|
62
|
+
<Insets bottom="1.0" left="1.0" right="1.0" top="1.0" />
|
63
|
+
</padding>
|
64
|
+
</CheckBox>
|
65
|
+
<CheckBox layoutX="26.0" layoutY="37.0" mnemonicParsing="false" text="CheckBox" AnchorPane.rightAnchor="1.0">
|
66
|
+
<padding>
|
67
|
+
<Insets bottom="1.0" left="1.0" right="1.0" top="1.0" />
|
68
|
+
</padding>
|
69
|
+
</CheckBox>
|
70
|
+
<CheckBox layoutX="26.0" layoutY="52.0" mnemonicParsing="false" text="CheckBox" AnchorPane.rightAnchor="1.0">
|
71
|
+
<padding>
|
72
|
+
<Insets bottom="1.0" left="1.0" right="1.0" top="1.0" />
|
73
|
+
</padding>
|
74
|
+
</CheckBox>
|
75
|
+
</children>
|
76
|
+
</AnchorPane>
|
77
|
+
<TableView prefHeight="480.0" prefWidth="100.0">
|
78
|
+
<columns>
|
79
|
+
<TableColumn prefWidth="99.0" text="予定" />
|
80
|
+
</columns>
|
81
|
+
</TableView>
|
82
|
+
<TextArea prefHeight="164.0" prefWidth="100.0">
|
83
|
+
<VBox.margin>
|
84
|
+
<Insets />
|
85
|
+
</VBox.margin>
|
86
|
+
</TextArea>
|
87
|
+
</children>
|
88
|
+
</VBox>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<Slider orientation="VERTICAL" />
|
93
|
+
</children>
|
94
|
+
</HBox>
|
95
|
+
|
96
|
+
package application;
|
97
|
+
|
49
98
|
```
|
99
|
+
```java
|
100
|
+
package application;
|
101
|
+
|
102
|
+
import javafx.application.Application;
|
103
|
+
import javafx.stage.Stage;
|
104
|
+
import javafx.scene.Scene;
|
105
|
+
import javafx.scene.layout.BorderPane;
|
50
106
|
|
107
|
+
|
108
|
+
public class Main extends Application {
|
109
|
+
@Override
|
110
|
+
public void start(Stage primaryStage) {
|
111
|
+
try {
|
112
|
+
BorderPane root = new BorderPane();
|
113
|
+
Scene scene = new Scene(root,400,400);
|
114
|
+
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
|
115
|
+
primaryStage.setScene(scene);
|
116
|
+
primaryStage.show();
|
117
|
+
} catch(Exception e) {
|
118
|
+
e.printStackTrace();
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
public static void main(String[] args) {
|
123
|
+
launch(args);
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
```
|
128
|
+
```java
|
129
|
+
package application;
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Sample Skeleton for 'ScheduleTable.fxml' Controller Class
|
133
|
+
*/
|
134
|
+
|
135
|
+
import java.net.URL;
|
136
|
+
import java.util.ResourceBundle;
|
137
|
+
|
138
|
+
import javafx.fxml.FXML;
|
139
|
+
|
140
|
+
public class PleaseProvideControllerClassName {
|
141
|
+
|
142
|
+
@FXML // ResourceBundle that was given to the FXMLLoader
|
143
|
+
private ResourceBundle resources;
|
144
|
+
|
145
|
+
@FXML // URL location of the FXML file that was given to the FXMLLoader
|
146
|
+
private URL location;
|
147
|
+
|
148
|
+
@FXML // This method is called by the FXMLLoader when initialization is complete
|
149
|
+
void initialize() {
|
150
|
+
|
151
|
+
}
|
152
|
+
}
|
153
|
+
```
|
51
154
|
### 試したこと
|
52
|
-
|
53
155
|
・fxmlにLabelをimportする
|
54
156
|
・<!DOCTYPE configuration>を追加する
|
55
157
|
・Labelを削除してみる→今度はcheckboxで同様のエラーが起きた。
|
56
|
-
|
57
158
|
### 補足情報(FW/ツールのバージョンなど)
|
58
|
-
|
59
159
|
javaSE 11
|
60
160
|
JavaFX 11
|
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
javaFXのloadで、例外が起きました。
|
2
|
-
|
2
|
+
|
3
3
|
javafxを初めて使って、とりあえず何か作ってみようと思って実行してみると、Label is not a valid type.とエラーが出ました。そこで調べてみると、Labelがimportされていないようだったので、importして実行してみると、今度は、ClassMotFoundExeptionが出てしまいまい、調べても英語の記事ばっかりで挫折してしまいました…
|
4
4
|
何のクラスが見つからないのか、どうやったら治せるか教えてください!
|
5
5
|
あと、fxmlではjavafx.scene.layout.*で、すべてのlayoutをimportしているはずなのに何故もう一回importしないといけないのかも教えていただけると嬉しいです!
|