• Post Reply Bookmark Topic Watch Topic
  • New Topic

Components not showing in program. Something wrong with my fx:id?

Jon Jonson
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have made a UI in SceneBuilder where I have an Anchorpane. In the Controller Class I want to add elements to this Anchorpane and have declared an Anchorpane with the same name as the fx:id used in SceneBuilder like this:

I had to add the "= new AnchorPane()" to avoid a Null pointer exception if SearchTabAnchorPane was used in the program. And this leads me to think that maybe this is now not the same object that I made in SceneBuilder. Correct?

And now if I try to add to the Anchorpane during the Controller Class Initialize medhtod (implements Initializable), no components show when I run the program. Here is the code to add the Component.

Have I broken the link between the SceneBuilder AnchorPane and the one I declare in the Controller Class? If so what Im I doing wrong?

Thanks for reading!
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!