So I've created some comboboxes with a variety of elements in alphabetical order. I do not want the default selection on my menu to be the top value; rather, I want it to be the most commonly selected value. In swing I could call the member function setSelectedIndex()
and simply pass in the index of the most popular menu value. How can I do this in seesaw? The seesaw documentation says the options are :model
and :renderer
, but I can't find anything to allow me to set the default index...
Is there additional documentation I'm missing?
There's a function selection!
you can use:
(defn combotest []
(let [w (frame :title "Combobox Test" :width 200 :height 80)
combo (combobox :model ["A" "B" "C"])
pnl (horizontal-panel :items [combo])]
(config! w :content pnl)
(selection! combo "C") ;; <--- boom ---
(show! w)))
Also, these are still Swing items we're working with, so at the end of the day, we can also do:
(.setSelectedIndex combo 2)