Search code examples
scalascala-swing

Scala Swing ComboBox Editable


A simple question (but can't find any answer nonetheless :(). Java's Swing has an editable property for the ComboBox so user can type to find the value. I check Scala's ComboBox implementation, and there is an editable property.

So the question is, how can I set the ComboBox's editable to true (or false) in Scala's Swing?

Thanks before.


Solution

  • There is makeEditable method, but I can't find any inverse method so you have to use underlying component (scala swing is just a thin wrapper over java swing) to set editability to false:

    mycombo.peer.setEditable(false)