I\'m trying to add some options to the context menu in a JavaFX WebView when the user right clicks a link, however I can\'t figure out how to do it.
I found I could
Currently that's not possible. There is an open issue on JavaFX for that: https://javafx-jira.kenai.com/browse/RT-20306
If you just want to add a different context menu, then you could do that
webView.setOnMouseClicked(new EventHandler() {
@Override
public void handle(MouseEvent mouse) {
if (mouse.getButton() == MouseButton.SECONDARY) {
menu = new ContextMenu();
//add some menu items here
menu.show(this, mouse.getScreenX(), mouse.getScreenY());
} else {
if (menu != null) {
menu.hide();
}
}
}
});