Reputation: 36351
I am trying to get a Tab
from my application like this:
searchTab = (Tab)scene.lookup("#searchTab");
But I am getting this error:
incompatible types: Node cannot be converted to Tab
Both of these work:
settingsButton = (Button)scene.lookup("#settingsButton");
searchBox = (AnchorPane)scene.lookup("#searchBox");
It works with all other types of components, why isn't it working with Tab
?
Upvotes: 2
Views: 1321
Reputation: 36351
To get the tab, I am able to use getTabs()
and then select the tab id with get()
This example demonstrates that:
tabPane = (TabPane)scene.lookup("#tabPane");
tabPane.getTabs().get(0).setGraphic(searchiv);
Upvotes: 2
Reputation: 7461
Tab
is not Node
(doesn't extends it anyway), so you cannot convert it. To say, what is actual type of searchTab
, output searchTab.getClass().getName()
in runtime.
Upvotes: 1