MCPcopy Create free account
hub / github.com/benfry/processing4 / setValue

Method setValue

java/src/processing/mode/java/tweak/Handle.java:172–196  ·  view source on GitHub ↗
(Number value)

Source from the content-addressed store, hash-verified

170
171
172 public void setValue(Number value) {
173 if ("int".equals(type)) {
174 newValue = value.intValue();
175 strNewValue = String.format(Locale.US, textFormat, newValue.intValue());
176
177 } else if ("hex".equals(type)) {
178 newValue = value.intValue();
179 strNewValue = String.format(Locale.US, textFormat, newValue.intValue());
180
181 } else if ("webcolor".equals(type)) {
182 newValue = value.intValue();
183 // keep only RGB
184 int val = (newValue.intValue() & 0xffffff);
185 strNewValue = String.format(Locale.US, textFormat, val);
186
187 } else if ("float".equals(type)) {
188 BigDecimal bd = new BigDecimal(value.floatValue());
189 bd = bd.setScale(decimalPlaces, RoundingMode.HALF_UP);
190 newValue = bd.floatValue();
191 strNewValue = String.format(Locale.US, textFormat, newValue.floatValue());
192 }
193
194 // send new data to the server in the sketch
195 sendNewValue();
196 }
197
198
199 public void updateColorBox() {

Callers 15

updateValueMethod · 0.95
startSaveAsThreadMethod · 0.45
doInBackgroundMethod · 0.45
setProgressMethod · 0.45
resetProgressBarMethod · 0.45
JEditTextAreaMethod · 0.45
getSubKeysMethod · 0.45
getValuesMethod · 0.45
triggerMethod · 0.45
moveUpMethod · 0.45

Calls 3

sendNewValueMethod · 0.95
formatMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected