要说这fxml语法有点奇特,在控件中加入右键菜单的代码如下
<TreeView fx:id="foldertree" GridPane.rowIndex="2" GridPane.columnIndex="0" GridPane.hgrow="ALWAYS" GridPane.vgrow="ALWAYS">
<contextMenu>
<ContextMenu >
<items><MenuItem text="ss" /></items>
</ContextMenu>
</contextMenu>
</TreeView>