Hi All,
I am using javaFX 2.0.2 (with Netbeans 7.1).
I have not found plausible documentation on how to define ContextMenu in FXML file. I did find code samples using setContextmenu(), but no info howto convret it to FXML.
After several unsuccessful tries (even assigning the contextmenu to a control was not immediate) I found that the below fxml structure (at least) does not throw errors, but does not work either. I right mouse click the textfield and nothing happens.
<TextField text="OVERVIEW" style="-fx-padding: 5 5 5 5"
GridPane.columnIndex="0" GridPane.rowIndex="0">
<children>
<ContextMenu fx:id="contextMenuDB">
<items>
<MenuItem text="Import"
onAction="#ImportDB"/>
<MenuItem text="Export"
onAction="#ExportDB"/>
<MenuItem text="Report"
onAction="#CreateReport"/>
</items>
</ContextMenu>
</children>
</TextField>
Is the <children> tag the right way or should I use some other tag instead?
Do I need to do anything (I mean coding) else than defining the contextmenu in FXML?
Thanks in advance for any comment.