controlsfx / controlsfx/controlsfx
Label's HoverProperty does not update correctly if in graphic of GridView cell in V8.40.9
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 300
- Avg merge
- 16d 17h
- Merged PRs (30d)
- 1
Description
**[Original report](https://bitbucket.org/controlsfx/controlsfx/issue/559) by Jonas (Bitbucket: [jsone-studios](https://bitbucket.org/jsone-studios), GitHub: [jsone-studios](https://github.com/jsone-studios)).**
----------------------------------------
I have a GridView with custom cells that contain an ImageView and a Label, both in VBox which is set as the graphic of the cell. The text of the label should be underlined if the mouse is over the label. So I bind the hoverProperty of the Label to the underlineProperty of the Label. But the Label is not shown underline. So I have debugged the hoverProperty and found out that it is flipping constantly from true to false and back if the mouse is over the Label. In plain javafx TableCells the hoverProperty changes as expected, so it must be an issue with GridView.
Here my Custom GridCell class:
```
#!java
public class CustomGridCell extends GridCell
{
private final ImageView imageView;
private final Label name;
public AlbumGridCell()
{
imageView = new ImageView();
imageView.setFitHeight(200);
imageView.setFitWidth(200);
name = new Label();
}
@Override
protected void updateItem(Data item, boolean empty)
{
super.updateItem(item, empty);
if (empty)
{
setGraphic(null);
}
else
{
Image image = item.getImage();
imageView.setPreserveRatio(image.isPreserveRatio());
imageView.setSmooth(image.isSmooth());
imageView.setImage(image);
name.setText(item.getName());
name.hoverProperty().addListener((observable, oldValue, newValue) -> {
System.out.println("hover " + newValue);
});
name.underlineProperty().bind(name.hoverProperty());
setGraphic(new VBox(image, name));
}
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.