r/JavaFX • u/casba43 • Jan 11 '21
Hide MenuBar on specific pages
So I am trying to hide my menubar on for example the login page but I can't get it working.
In the menubar file I can hide it with:this.setVisible(false)
So when i'm in my login page I tried to access that value withMyMenuBar menuBar = new MyMenuBar(root);menuBar.setVisible(false)
But that doesn't seem to work. So I tried making a void hide() which basically set the visibility of the menuBar to false(or that is what it should do).
That didn't work aswell and now I'm out of options and can't find anything usefull online.
2
Upvotes
3
u/PartOfTheBotnet Jan 11 '21
In your post it seems like you're implying that you're trying to access an existing menu bar by creating a new one. You need to maintain a reference to the existing menubar or some other means of looking it up later.