Hello,
I ran into this problem while working on simple object check box / onoff button.
I wanted to be able to determin the type(looks) of my button in the costructor by an enum
for example: checkbox_box, checkbox_circle, switch and so on.
I am aware of the possibility of using a String or workaround using a valueOf()
Sadly both includes the use of String in the costructor and that just what i am trying to avoid.
Here’s a link to a post i found that seems to be working in Java only:
Any suggestions on how to make it possible in Processing?
Here’s a simle pseudo code of what i am trying to achieve:
Test myTest;
myTest = new Test(Type.E1);
class Test {
Test(enum Type) {
this.Type = t;
}
void run() {
switch(t) {
case E1:
println("1");
break;
case E2:
println("2");
break;
default:
}
}
}
public enum Type {
E1, E2
}