processing - Java, how to store multiple integers, separated by comma, into one variable -
in java, want setup variable can store multiple integers (rgb values) , integers separated comma. example, current code like
background(255,255,0); // changes gui background color yellow.
the code want is
type yellow = (here goes yellow's rgb value 255,255,0) background(yellow);
my question how setup variable yellow can replace actual rgb values. thank you.
all answers got far somehow solve problem described. problem is: not helpful.
never put information strings , rely on parsing them. if want that; not need overhead of statically compiled language java. better of using languages python, ruby ... allow handle "stringified" information easier.
what want is: learn object orientation. so, want represent colors. model class represents color. somehow like:
public class color { private final int r, g, b; public color(int r, ... { this.r = r
and on. can write down color
color yellow = new color(255,255,0)
heck; start , declare constants representing useful predefined colors.
you know, existing java awt color class.
so: please take time learn , understand concepts talking about; , keep in mind: using strings such purposes absolutely bad.
Comments
Post a Comment