I made an extension of the JavaFX ListView component :
HL7ListView extends ListView<String>
The goal is for it to auto-scroll the parent ScrollPane as new items are added to it. I have a constructor that takes the ScrollPane in question as an argument and I made an addItem() method like this :
public void addItem(String item)
{
List<String> items = getItems();
items.add(item);
scrollTo(items.size());
scrollPane.setVvalue(1.0);
}
The auto scrolling only works when i manually scroll to the bottom once to "get it going" if that makes any sense. Once it is scrolled to the bottom, new items behave as expected and the scrollbar goes down automatically, trailing the ListView's content. Not sure what could be the problem here, obviously the scroll bar only appears when there is a need for it, not sure if that could have anything to do with this.
Any idea?