From: Joachim B. <jba...@pi...> - 2005-01-26 06:45:04
|
Hello, I have the following suggestion for a change of the ComboBoxWidget.setValue behavior to avoid errors: - The value has to be 0 or more - The index of the corresponding JComboBox is set to 0 if the value - the minimum value is less than 0 Here is the code: /** * Set the value for the ComboBoxWidget. * The index for the corresponding JComboBox is * the value subtracted by the minimum value. * * @param v The value, has to be 0 or more */ public void setValue(int v) { // Only set value if it is 0 or more if (v >=3D 0) { super.setValue(v); if ( (v - getValueMin() ) >=3D 0 ) { cb.setSelectedIndex(v - getValueMin()); } else { cb.setSelectedIndex(0); } } } Actual code: public void setValue(int v) { super.setValue(v); cb.setSelectedIndex(v - getValueMin()); } What do do you think of it? Best regards, Joachim Backhaus |