This is the java
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
public class mains extends Stage {
public static void main(String[] args) {
new JFXPanel();
Platform.runLater(new Runnable(){
@Override
public void run() {
new mains();
}
});
}
void go(){
new JFXPanel();
new mains().show();
}
public mains() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(
"LOL.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (Exception e) {
e.printStackTrace();
}
}
@FXML
private Button button;
@FXML
private Label label;
@FXML
void push(ActionEvent event) {
}
}
here is the fxml http://pastebin.com/uzBrMRDV I get a load exception it says Root is already specified. If i remove the setRoot(this); it doesnt load at all I am getting really frustrated with JFX... Is there anyway to load FXML files like a Stage from the controller itself