- Joined
- May 15, 2018
- Messages
- 6
- Thread Author
- #1
Trying to get EmbeddableUI to work, it's having trouble issues finding my resources.
Here's the error message:
Here's my main class:
And here's a picture of my file tree:
Here's the error message:
Code:
javafx.fxml.LoadException:
unknown path
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2425)
at com.hexdump.bots.bot.ExampleBot.botInterfaceProperty(ExampleBot.java:44)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.hexdump.bots.bot.ExampleBot.initialize(ExampleBot.java:56)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
... 6 more
Here's my main class:
Code:
public class ExampleBot extends TreeBot implements EmbeddableUI, Initializable {
private ObjectProperty<Node> botInterface;
private ImageView img;
public ExampleBot() {
setEmbeddableUI(this);
}
@Override
public void onStart(String... arguments) {
setLoopDelay(400, 950);
}
@Override
public TreeTask createRootTask() {
return new RootBranch();
}
@Override
public ObjectProperty<? extends Node> botInterfaceProperty() {
if (botInterface == null) {
FXMLLoader loader = new FXMLLoader();
loader.setController(this);
try {
Node node = loader.load(Resources.getAsStream("com/hexdump/bots/bot/ExampleXFML.fxml"));
botInterface = new SimpleObjectProperty<>(node);
} catch (IOException e) {
e.printStackTrace();
}
}
return botInterface;
}
@Override
public void initialize(URL location, ResourceBundle resources) {
img.setImage(new Image(Resources.getAsStream("com/hexdump/bots/bot/img.jpg")));
}
}
And here's a picture of my file tree:
