- Joined
- Feb 15, 2016
- Messages
- 64
- Thread Author
- #1
Hey guys,
Got a quick question. I'm trying to make a startup GUI for my bot using JavaFX. Had some troubles using JavaFX at first but a quick Google search fixed that. My current problem is that the input stream for my .fxml file is apparently null even though it shouldn't be. I'll add my code and an image of my project layout which should do more talking than my words.
Thanks.
GUI File
(note: I also tried other paths like "/RuneMate/src/com/smitty260/cowkiller/CowKiller.fxml" and other variants like that)
Project Layout
Got a quick question. I'm trying to make a startup GUI for my bot using JavaFX. Had some troubles using JavaFX at first but a quick Google search fixed that. My current problem is that the input stream for my .fxml file is apparently null even though it shouldn't be. I'll add my code and an image of my project layout which should do more talking than my words.
Thanks.
GUI File
(note: I also tried other paths like "/RuneMate/src/com/smitty260/cowkiller/CowKiller.fxml" and other variants like that)
Code:
package com.smitty260.cowkiller;
import java.io.IOException;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class CowKillerGui extends Stage {
public CowKillerGui (CowKiller script) {
try {
FXMLLoader loader = new FXMLLoader();
loader.setController(new CowKillerController(this));
final Parent root = loader.load(CowKiller.class.getResourceAsStream("CowKiller.fxml"));
final Scene scene = new Scene(root);
setTitle("Cow Killer");
setScene(scene);
} catch (IOException e) {
e.printStackTrace();
}
show();
}
}
Project Layout