// ------------------------------------------------ // Set and Get the values of the properties // ------------------------------------------------ public void setValue(int _index, Value _value) { switch (_index) { case 0: setValue(_value.getDouble()); break; case 1: setMinimum(_value.getDouble()); break; case 2: setMaximum(_value.getDouble()); break; case 3: { DecimalFormat newFormat; if (_value.getObject() instanceof DecimalFormat) { newFormat = (DecimalFormat) _value.getObject(); } else { newFormat = null; } if (format == newFormat) { return; // and save time } format = newFormat; if (format != null) { bar.setString(format.format(variable)); bar.setStringPainted(true); } else { bar.setStringPainted(false); } } break; case 4: if (bar.getOrientation() != _value.getInteger()) { bar.setOrientation(_value.getInteger()); } break; default: super.setValue(_index - 5, _value); break; } }
public void setDefaultValue(int _index) { switch (_index) { case 0: break; // Do nothing case 1: setMinimum(0.0); break; case 2: setMaximum(1.0); break; case 3: format = null; bar.setStringPainted(false); break; case 4: bar.setOrientation(JProgressBar.HORIZONTAL); break; default: super.setDefaultValue(_index - 5); break; } }