I am trying to call a popup windows from "jfxmessagebox".jar and it is working well!
The only problem if I move this code to another .java file, it is missing my scene. So I need to import the scene somehow and get the rights to use this, but I don't know the exact statement to do that.
My code is:
public void start(Stage Main) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
Scene scene = new Scene(root);
String css = program.class.getResource("Style.css").toExternalForm();
scene.getStylesheets().add(css);
main.setScene(scene);
main.setTitle("Application");
main.setWidth(800);
main.setHeight(600);
main.show();
MessageBox.show(main,"welcome to my application!");
}
So it is working fine, but if I copy this line:
MessageBox.show(main,"welcome to my application!");
to another .java file at the same package, the "main" word is underlined with red, and says "missing main variable"
How should I implement?
Aucun commentaire:
Enregistrer un commentaire