ContextMenu not hiding properly

Scott Palmer swpalmer at gmail.com
Wed Dec 26 10:34:04 PST 2012


As part of migrating my app from Swing to JavaFX I just implemented some ContextMenus in a full JFXPanel-free JavaFX app.  The ContextMenu is attached to a node dynamically via the ContextMenu.show(Node, x, y) method. (Never via setContextMenu, since the menu items are constructed on the fly.)
But I ran into this issue, which has been around for a year.
http://javafx-jira.kenai.com/browse/RT-14899

Basically ContextMenus don't go away when they should.  In this case I am NOT using JFXPanel, but I was going to do the ContextMenus as part of a piece-wise migration of my app that is using JFXPanel.  Converting the JPopupMenus on my JFXPanel to ContextMenus.

Since in my application I am making something similar to a UML diagram and I show a context menu when right-clicking between the blocks (the blocks are like the classes in a UML diagram) the user manipulates, the context menu doesn't dismiss if I click on the background again, or if I click on one of the blocks in the diagram, since they are child nodes of the node showing the context menu.  I do see it dismiss properly when I show a context menu for one block and then click on another block.

In fact the user can interact with the entire document, pressing buttons, moving scroll bars, etc. while the context menu sits in the middle of the screen.

Is this something that might be fixed in time for the 7u12 update?  I was hoping to be able to migrate to a full JavaFX app in the 7u12 timeframe.  But maybe it won't be ready and I have to adjust my plans. 

Is there more to this issue than meets the eye?  Is there a simple workaround? I was going to look into it deeper.  If I were to look to make a patch what repo should I be working in?


Regards,

Scott



More information about the openjfx-dev mailing list