jfreechart-fx
jfreechart-fx copied to clipboard
ChartViewer constructor with contextMenuEnabled parameter seems that is not working
Hello @jfree ,
I realized that when I am constructing a new ChartViewer like the bellow:
this.chartViewer = new ChartViewer(chart, false);
the context menu is still not disabled on the chart. I look into the source code and looks like contextMenuEnabled field has not been used.
public ChartViewer(JFreeChart chart, boolean contextMenuEnabled) {
this.canvas = new ChartCanvas(chart);
this.canvas.setTooltipEnabled(true);
this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", this));
this.setFocusTraversable(true);
this.getChildren().add(this.canvas);
this.zoomRectangle = new Rectangle(0.0D, 0.0D, new Color(0.0D, 0.0D, 1.0D, 0.25D));
this.zoomRectangle.setManaged(false);
this.zoomRectangle.setVisible(false);
this.getChildren().add(this.zoomRectangle);
this.contextMenu = this.createContextMenu();
this.setOnContextMenuRequested((event) -> {
this.contextMenu.show(this.getScene().getWindow(), event.getScreenX(), event.getScreenY());
});
this.contextMenu.setOnShowing((e) -> {
this.getCanvas().setTooltipEnabled(false);
});
this.contextMenu.setOnHiding((e) -> {
this.getCanvas().setTooltipEnabled(true);
});
}
How can I disable context menu in this case? Thanks.