I’m trying to write a mini file browser, where I display a list of files, and replace the list by another when I change directories.
I can display a list:
val myList = List("Paris", "New York", "Tokyo", "Berlin", "Copenhagen")
val myListBuffer = new ListBuffer[String] ()
myListBuffer.appendAll(myList)
val myListView = new ListView(myListBuffer)
...
contents += myListView
In response to an event, I want to change the displayed contents. Most of what I’ve tried makes the list “invisible” (but still responding to selection by up and down arrows)–sometimes by making elements invisible only when they are selected!
How do I update the ListView to reflect the new contents of the ListBuffer? Or can someone point me to an example of this?
Thanks.
This seems to work: