Closed xwaeaewcrhomesysplug closed 3 years ago
Thank you for your interest in my library. Your code example has no reference to the JavaFX environment resp. application. As starting point, you can study the JUnit-test of Time4J.
While your Stage
-object is just self-created my JUnit test takes it from JavaFX-app as parameter of the start()
-method of Application
-object. Just try it yourself and change your code appropriately. Update: This was not the error but your code missed to show how you launch your app (what was the real error).
By the way, you might also get good answers on the stackoverflow website - especially in this case which does not appear to be directly related to Time4J.
I have seen that you have posted your question now also on Stackoverflow-website. The answer of @jetspiking will point you into the right direction.
Your mistake was simply to have put the application launch into the wrong method. The launch must be within the main() method, or for a JUnit-test - within the open()-method. The JavaFX-stuff itself is only executed within the start()-method.
So following code works:
public class Demo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
// Launch all your JavaFX code and methods from inside this Entry Point function.
Stage stage = new Stage();
CalendarPicker<PlainDate> picker = CalendarPicker.gregorianWithSystemDefaults();
Scene scene = new Scene(picker, 300, 250);
stage.setScene(scene);
stage.setTitle("Date pick test");
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
I tried> net.time4j.ui.javafx.CalendarPicker obj=net.time4j.ui.javafx.CalendarPicker.gregorianWithSystemDefaults(); javafx.scene.Scene scn=new javafx.scene.Scene(obj, 300, 250); Stage stage = new Stage(); stage.setTitle("Date pick test");//scn.getChildren().add(obj); stage.setScene(scn); stage.show();
it does not seems to show any stuff.Any idea?