You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To enable dynamical Swing comboboxes, scala.swing.ComboBox should also be able to use the MutableComboBoxModel. Something like the addition of a mutable model in addition to the existing constant model:
classMutableModel[A](items: Buffer[A]) extendsConstantModel(items) withMutableComboBoxModel {
defremoveElementAt( n: Int ) = items.remove( n )
defremoveElement( item: Any ) = items.remove( items.indexOf(item) )
definsertElementAt( item: Any, n: Int ) = items.insert( n, item.asInstanceOf[A] )
defaddElement( item: Any ) = items.append( item.asInstanceOf[A] )
}
The choice of the model could depend on some parameters in the constructor (e.g. matching Seq or Buffer).
The text was updated successfully, but these errors were encountered:
I would recommend making ComboBox accept a mode. Provide a default mutable model implementation and allows users to create their own. The example above uses an immutable Seq because I rather use this.
I would also suggest making the model type visible so you don't have to add a bunch o methods in ComboBox and have to deal with mutable and immutable collections.
To enable dynamical Swing comboboxes, scala.swing.ComboBox should also be able to use the MutableComboBoxModel. Something like the addition of a mutable model in addition to the existing constant model:
The choice of the model could depend on some parameters in the constructor (e.g. matching Seq or Buffer).
The text was updated successfully, but these errors were encountered: