Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ChartViewer constructor with contextMenuEnabled parameter seems that is not working #20

Open
mehdimonemi opened this issue Nov 17, 2021 · 0 comments

Comments

@mehdimonemi
Copy link

mehdimonemi commented Nov 17, 2021

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant