79523279

Date: 2025-03-20 14:46:58
Score: 3
Natty:
Report link

How did We Get the size of Stage before it was shown??

I set the height and the width of the stage before the start function.

Public void start( Stage primaryStage){

primaryStage.setHeight(500);

primaryStage.setWigth(500);

...

System.out.println(primaryStage.getHeight() +" - "+ primaryStage.getWidth());

...

primaryStage.setScene(scene);

primaryStage.show();

}

If you write "primaryStage.getHeight()" after "primaryStage.setHeight(500);"

the result will be "NaN"

Thank you, hope I help you

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • No code block (0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): How did We
  • Low reputation (1):
Posted by: Hadi Badaoui