当前位置: 动力学知识库 > 问答 > 编程问答 >

scala.swing.ListView: single/multiple selection

问题描述:

How do I make scala.swing.ListView only allow a single item to be selected at a time?

I want to disable the default behavior of allowing multiple items to be selected.

网友答案:

The most trivial way is to use peer property which is standard Swing JList:

listView.peer.setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
网友答案:

I am using following (Scala 2.9.0-1):

import swing.ListView
import swing.ListView.IntervalMode

val listView: ListView[String] = new ListView[String](Seq("a", "b", "c")) {
  selection.intervalMode = IntervalMode.Single
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: