PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/Console/console/bsh/commandoCHOICE.bsh

#
Unknown | 26 lines | 23 code | 3 blank | 0 comment | 0 complexity | 98e2903307441073b73610605841a6d9 MD5 | raw file
 1commandoCHOICE(view,pane,ns,label,var,options)
 2{
 3	choice = new JComboBox(options);
 4	value = ns.getVariable(var);
 5	if(value != null)
 6	{
 7		for(int i = 0; i < options.size(); i++)
 8		{
 9			opt = options.elementAt(i);
10			if(value.equals(opt.value))
11			{
12				choice.setSelectedIndex(i);
13				break;
14			}
15		}
16	}
17
18	valueChanged()
19	{
20		ns.setVariable(var,choice.getSelectedItem().value);
21	}
22
23	pane.addComponent(label,choice);
24
25	return this;
26}