Error in creating button on javafx | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Error in creating button on javafx

https://code.sololearn.com/cL7aRikZ4lt5/?ref=app I have error in root.getChildren().add(btn) error appears when I write .add (btn)

30th Sep 2017, 8:28 AM
Nuruddin
Nuruddin - avatar
3 Answers
+ 10
First call add for all nodes, after that call show. Not the other way round like you did.
30th Sep 2017, 9:35 AM
Tashi N
Tashi N - avatar
+ 8
Sorry, I'm on mobile and can't test your code. Please add the stack trace error output. I think, you have to call show at the end after you added all nodes, not at the beginning. But the error message might give a hint ;)
30th Sep 2017, 9:31 AM
Tashi N
Tashi N - avatar
0
yes I know that I need show and scene I did it but error only in .add ()
30th Sep 2017, 9:34 AM
Nuruddin
Nuruddin - avatar