
393Customizing MATLAB
®
Controls
>> import javax.swing.ListSelectionModel
>> selectionMode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION;
>> jListbox.setSelectionMode(selectionMode);
>> % Now use <Shift> to select several list items
Warning: single-selection listbox control requires a scalar Value
Control will not be rendered until all its parameter values are valid
(Type "warning off MATLAB:hg:uicontrol:ParameterValuesMustBeValid" to
suppress this warning.)
>> get(hListbox,'Value')
ans =
2 4 5 6
>> set(hListbox,'Max',2); % Now ok – no more warning messages!
Also note that changing the HG handle’s Max property causes the underlying jListbox to
be ...