2

Given the following code:

enum Functions
{
  background,clear,colorMode,fill,noFill,noStroke,stroke,applyMatrix,popMatrix,
  printMatrix,pushMatrix,resetMatrix,rotate,rotateX,rotateY,rotateZ,scale,shearX,shearY,
  translate,ellipseMode,smooth,noSmooth,rectMode,strokeCap,strokeJoin,strokeWeight,arc,ellipse,
  line,point,quad,rect,triangle,size,frameRate;
}

switch(Functions.valueOf(f))
{  
   case background:
     //background()
     background(random(255),random(255),random(255));
     break;
   case clear:
     //clear()
     break;
   case colorMode:
     //colorMode()
     break;
   case fill:
     //fill()
     fill(random(255),random(255),random(255));
     break;
   case size:
     //size()
     break;
   .....
}

This is running fine most of the time, and no other Enum const has been throwing this error:

IllegalArgumentException: No enum const class Functions.size

But for some reason, Functions.size will sometimes cause this error to be thrown. Does anyone know why this might be happening intermittently?

PM 77-1
  • 12,933
  • 21
  • 68
  • 111
kyuen
  • 23
  • 1
  • 4

0 Answers0