r/JavaFX • u/Draaksward_89 • Jan 21 '25
Help How to clear an ItemView?
I'm working on a UI part, which is basically a list of directories and its contents

Whenever you select the ChoiceBox, there is a list of subfolders.
I have a ChangeListener hooked up to ChoiceBox, which basically calls
listView.getItems().clear();
listView.getItems().addAll(...);
listView.refresh();If I'm switching content of listView from 10 elements to 3 (from `Interrogator` to `Pariah Nexus`) I'm getting leftovers.
And the leftovers are not clickable. Just a graphical glitch.
How to address this?
1
Upvotes
View all comments
Show parent comment
1
u/Draaksward_89 Jan 21 '25
This is the whole code for the listener
where `fileList_folder` is the ChoiceBox and `fileList` is the ListView.
Or you're speaking of something else?