javafx – controlsfx – CheckTreeView – click on CheckBoxTreeItem graphic node is checking the checkbox

Issue

This Content is from Stack Overflow. Question asked by psova

When I will add a graphic node (HBox with ImageView) into CheckBoxTreeItem it behaves as a checkbox.

here is an example code:

final Image myImage = new Image("my_image.png");
ImageView myImgView = createImageView(myImage);
HBox imgHbox = new HBox();
imgHbox.setAlignment(Pos.CENTER);
imgHbox.setPadding(new Insets(0, 0, 0, 5));
imgHbox.getChildren().add(myImgView );
CheckBoxTreeItem newDirParent = new CheckBoxTreeItem<>(myTreeItem, imgHbox);

Any idea how to change the behavior from checking the checkbox to selecting the row?

img from the app

here is the image with highlighted icons used in the CheckBoxTreeitems. when I click them they will just check/uncheck the checkbox in the same row…



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?