summaryrefslogtreecommitdiff
path: root/src/swing
diff options
context:
space:
mode:
authorIngo Maier <ingo.maier@epfl.ch>2009-04-18 09:01:52 +0000
committerIngo Maier <ingo.maier@epfl.ch>2009-04-18 09:01:52 +0000
commit1e1231c1500ce8888628ff35230e5b20d12bea01 (patch)
tree4565dbefe457a210c31bd4454333caaffcd5ddb7 /src/swing
parentc516c42d42a5b7a9979d9acf30cee05e9016a4fb (diff)
downloadscala-1e1231c1500ce8888628ff35230e5b20d12bea01.tar.gz
scala-1e1231c1500ce8888628ff35230e5b20d12bea01.tar.bz2
scala-1e1231c1500ce8888628ff35230e5b20d12bea01.zip
Fire when combo box selection changes
Diffstat (limited to 'src/swing')
-rw-r--r--src/swing/scala/swing/ComboBox.scala8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/swing/scala/swing/ComboBox.scala b/src/swing/scala/swing/ComboBox.scala
index 219972d22f..44919f077a 100644
--- a/src/swing/scala/swing/ComboBox.scala
+++ b/src/swing/scala/swing/ComboBox.scala
@@ -115,7 +115,13 @@ object ComboBox {
new AbstractListModel with ComboBoxModel {
private var selected = items(0)
def getSelectedItem: AnyRef = selected.asInstanceOf[AnyRef]
- def setSelectedItem(a: Any) { selected = a.asInstanceOf[A] }
+ def setSelectedItem(a: Any) {
+ if ((selected != null && selected != a) ||
+ selected == null && a != null) {
+ selected = a.asInstanceOf[A]
+ fireContentsChanged(this, -1, -1)
+ }
+ }
def getElementAt(n: Int) = items(n).asInstanceOf[AnyRef]
def getSize = items.size
}