What is the justification for JavaFX FXML schema not supporting context menu inside the panes?

后端 未结 2 1626
半阙折子戏
半阙折子戏 2021-01-06 12:07

It is possible to add a context menu to a scroll pane, but not to other types of panes. Why?

2条回答
  •  情书的邮戳
    2021-01-06 12:40

    Described method to open popup leads to multiple popups open if every node in the scene graph want to open context menu. Consuming of event is definitely needed.

    See also discussion at Using FXML to Create ContextMenu within a Pane It provides working answer to this problem.

    BTW, Node.onContextMenuRequested(...) should be used instead, yes?

提交回复
热议问题