@@ -12,6 +12,8 @@ import event._
12
12
import javax .swing ._
13
13
import javax .swing .event ._
14
14
15
+ import scala .collection .JavaConverters .asScalaBufferConverter
16
+
15
17
object ListView {
16
18
/**
17
19
* The supported modes of user selections.
@@ -185,27 +187,23 @@ class ListView[A] extends Component {
185
187
def iterator : Iterator [B ] = a.iterator
186
188
}
187
189
188
- def leadIndex : Int = peer.getSelectionModel.getLeadSelectionIndex
189
- def anchorIndex : Int = peer.getSelectionModel.getAnchorSelectionIndex
190
+ def leadIndex : Int = peer.getSelectionModel.getLeadSelectionIndex
191
+ def anchorIndex : Int = peer.getSelectionModel.getAnchorSelectionIndex
190
192
191
193
/**
192
194
* The indices of the currently selected items.
193
195
*/
194
196
object indices extends Indices (peer.getSelectedIndices) {
195
- override def subtractOne (n : Int ): this .type = { peer.removeSelectionInterval(n,n); this }
196
197
override def addOne (n : Int ): this .type = { peer.addSelectionInterval (n,n); this }
198
+ override def subtractOne (n : Int ): this .type = { peer.removeSelectionInterval(n,n); this }
197
199
198
200
override def clear (): Unit = peer.clearSelection()
199
201
}
200
202
201
- // XXX TODO
202
- // /**
203
- // * The currently selected items.
204
- // */
205
- // object items extends scala.collection.SeqProxy[A] {
206
- // def self = peer.getSelectedValues.map(_.asInstanceOf[A])
207
- // }
208
- def items : Seq [A ] = ???
203
+ /**
204
+ * The currently selected items.
205
+ */
206
+ def items : Seq [A ] = peer.getSelectedValuesList.asScala
209
207
210
208
def intervalMode : IntervalMode .Value = IntervalMode (peer.getSelectionModel.getSelectionMode)
211
209
def intervalMode_= (m : IntervalMode .Value ): Unit = peer.getSelectionModel.setSelectionMode(m.id)
0 commit comments