"contains" as part of a switch statement
-
Hello to all :-)
I would like to style my buttons with a single LookAndFeel object.
To determine which text is displayed, I can check the following:
if(obj.text.contains(“someText”) g.drawText(“Text to draw”, area);
Is there a way to do this with a switch statement so that I don't have to write a separate if statement for each text?
The button text is already used elsewhere in the script, which is why I cannot change it afterwards and then use it as text for drawing.
Thank you very much
Oli -
@Oli-Ullmann use the button text as the key in a JSON object with the display string as value then you don‘t need to branch at all.
-
@Christoph-Hart
Many thanks for the answer! What do you mean by “button text”? The ID? -
@Oli-Ullmann obj.text