I have TreeView<TitledPane>and want to show only "unread" content TitledPane.
I would like to receive an event notification if the content is displayed on the screen TitledPane.
TitledPanehas expandedProperty(), so it crashed, but I don’t see anything to filter out TreeItems that are far from the TreeView and are not displayed.
Another potential way I was thinking about is to check the visibility of the node sitting in the TitledPane with visibleProperty, but this does not seem to work.
pane.visibleProperty().addListener(new EnhancedListener(pane));
private class EnhancedListener implements ChangeListener<Boolean>
{
Node parent;
EnhancedListener(Node parent)
{
this.parent = parent;
}
@Override
public void changed(ObservableValue<? extends Boolean> arg0,
Boolean arg1, Boolean arg2) {
TitledPane p = (TitledPane) parent;
System.out.println(((Label)p.getContent()).getText()+" " + arg2);
}
}
I am using JavaFX 2.0.3
damik source
share