java - How to use BreadCrumbBar in ControlsFX (JavaFX 8) -
i'm java beginner trying use breadcrumbbar controlsfx make navigation bar in desktop application i'm making using javafx 8. can't seem able bar work way want to, , searching tutorial online yielded no results. i've found api doesn't much.
my code attached below:
@fxml private breadcrumbbar bread; private treeitem<string> tree, tree1, tree2; @fxml private void initialize(){ tree = new treeitem<string>("log in"); tree1 = new treeitem<string>("language selection"); tree2 = new treeitem<string>("patient list"); tree.getchildren().addall(tree1, tree2); bread.setselectedcrumb(tree); } public void refresh(){ bread.setselectedcrumb(tree.nextsibling(bread.getselectedcrumb())); } the bar appears should log in screen showing "log in" selected crumb.i'm calling refresh main class every time want shift next breadcrumb button bar disappears when move on first screen. should't set selected crumb next sibling of tree i.e. tree1 ?
if knows how configure autonavigation function helpful too. (possibly more helpful sorting out own code if it's easy implement)
thanks!
the breadcrumbbar use tree display navigation, should create treeitem in consequence.
here example of tree 3 levels :
treeitem<string> root = new treeitem<string>("root"); treeitem<string> item1 = new treeitem<string>("item 1"); treeitem<string> item11 = new treeitem<string>("item 1.1"); treeitem<string> item12 = new treeitem<string>("item 1.2"); item1.getchildren().addall(item11, item12); treeitem<string> item2 = new treeitem<string>("item 2"); root.getchildren().addall(item1, item2); then have tree graphicaly represented :
<item11> / <item1> / \ <root> <item12> \ <item2> when use breadcrumbbar.setselectedcrumb(treeitem<?>) select
the bottom-most path node (the node on most-right side in terms of bread crumb bar)
so if use breadcrumb.selectedcrumbproperty().set(root); :

and if use breadcrumb.selectedcrumbproperty().set(item11); :

hope helps, trying figure out how works ^^
Comments
Post a Comment