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

# · Unknown · 26 lines · 23 code · 3 blank · 0 comment · 0 complexity · 98e2903307441073b73610605841a6d9 MD5 · raw file

  1. commandoCHOICE(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. valueChanged()
  18. {
  19. ns.setVariable(var,choice.getSelectedItem().value);
  20. }
  21. pane.addComponent(label,choice);
  22. return this;
  23. }