Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

LinkUtil.setLink() or LinkUtil.gotoPage() can't be set to Javafx MenuItem? #12

Open
ctoabidmaqbool opened this issue Apr 2, 2023 · 1 comment

Comments

@ctoabidmaqbool
Copy link

Hi! I am facing another issue, that's LinkUtil.setLink() can't be set to Javafx MenuItem?
As LinkUtil.setLink() only accepts Nodes. What is the currently solution?

Sample code for testing:

javafx.scene.control.MenuItem menuItemSubCategory = new MenuItem("Category");
LinkUtil.setLink(menuItemSubCategory, "/?buizCategory=");

This error is showing:

D:\NetBeansProjects\MyAPP\src\main\java\com\myapp\module\ImageSlider.java:447: error: incompatible types: MenuItem cannot be converted to Node
LinkUtil.setLink(menuItemSubCategory, "/?buizCategory="+ menuItemSubCategory.getText().replaceAll(" ", "%20"));

Or

javafx.scene.control.MenuItem menuItemSubCategory1 = new MenuItem("Category");
menuItemSubCategory1.setOnAction(event -> {
        LinkUtil.gotoPage(menuItemSubCategory1, "/?buizCategory=" + menuItemSubCategory1.getText().replaceAll(" ", "%20"));
});

Then this error is showing!

D:\NetBeansProjects\MyAPP\src\main\java\com\myapp\module\ImageSlider.java:447: error: incompatible types: MenuItem cannot be converted to Node
LinkUtil.gotoPage(menuItemSubCategory1, "/?buizCategory=" + menuItemSubCategory1.getText().replaceAll(" ", "%20"));
@FlorianKirmaier
Copy link
Contributor

Yes, that's a quite an annoying topic. You don't get the Node of the MenuItem by default.
I have to look into it, but I'm unsure whether it's solvable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants