I have an FXML file that I'm using to allow user input when requested. Right now I just put it in a new stage and do Stage.show()
. I would like to not have it appear in a new window and behave more like a ContextMenu
.
Looking at ContextMenu
class it doesn't appear that I can set the content based off an FXML file. Is there a way to do this either with ContextMenu
or Popup
or some other class I am unaware of?
ControlsFX has a PopOver control you might like. That PopOver can use any Node for its content, so you can simply create a popover, load a node from FXML and set the content of the popover to that node.
Although that library is quite nice, I wanted something simple that didn't require 3rd party downloads. I came up with this:
The problem was I didn't realize that a
Parent
could be considered aNode
for the methodPopup#getContent#add