[ControlP5] Try to change position of ''CaptionLabel'' of an array of "Groups" and get NullPointerException!
in
Contributed Library Questions
•
4 months ago
HI friends, im very stuck in a project i am doing. I have a several problem when i want to change the styles of the labels of a array of groups. I have 4 Groups, and i want to change his label to be center, i was thinking about a for cicle to change all in one..but i have some troubles.
So i have a defined simple groups..
- controlP5.Group g1; // Seteo de Temperatura
- controlP5.Group g2; // '' de Humedad
- controlP5.Group g3; // '' de Dioxido de carbono
- controlP5.Group g4;
Inside the
void setup(), i have:
- g1 = cp5.addGroup("Seteo de Temperatura")
- .setPosition( c1 , f1 )
- .setBackgroundColor(color(255,80))
- .setBackgroundHeight(g_h)
- .setWidth(g_w)
- .setBarHeight(w_barra);
- g2 = cp5.addGroup("Seteo de Humedad")
- .setPosition( c2 , f1 )
- .setBackgroundColor(color(255,80))
- .setBackgroundHeight(g_h)
- .setWidth(g_w)
- .setBarHeight(w_barra);
- g3 = cp5.addGroup("Seteo de Dioxido de Carbono")
- .setPosition( c1 , f2 )
- .setBackgroundColor(color(255,80))
- .setBackgroundHeight(g_h)
- .setWidth(g_w)
- .setBarHeight(w_barra);
- g4 = cp5.addGroup("Seteo de Luminosidad")
- .setPosition( c2 , f2 )
- .setBackgroundColor(color(255,80))
- .setBackgroundHeight(g_h)
- .setWidth(g_w)
- .setBarHeight(w_barra);
Then i make the array with the groups and try to change the position of label...
- controlP5.Group[] g_array = {g1,g2,g3,g4};
- for(i=0;i<4;i++){
- g_array[i].captionLabel();
- g_array[i].captionLabel().getStyle().marginLeft = 40;
- g_array[i].captionLabel().getStyle().marginTop = 10;
- }
Someone can help me??
thanks in advance!! so noob with Processing..
1