/bundles/plugins-trunk/Console/console/bsh/commandoCHOICE.bsh
Unknown | 26 lines | 23 code | 3 blank | 0 comment | 0 complexity | 98e2903307441073b73610605841a6d9 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- commandoCHOICE(view,pane,ns,label,var,options)
- {
- choice = new JComboBox(options);
- value = ns.getVariable(var);
- if(value != null)
- {
- for(int i = 0; i < options.size(); i++)
- {
- opt = options.elementAt(i);
- if(value.equals(opt.value))
- {
- choice.setSelectedIndex(i);
- break;
- }
- }
- }
- valueChanged()
- {
- ns.setVariable(var,choice.getSelectedItem().value);
- }
- pane.addComponent(label,choice);
- return this;
- }