We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › change button color controlP5
Page Index Toggle Pages: 1
change button color controlP5 (Read 883 times)
change button color controlP5
Jul 5th, 2008, 4:55pm
 
hello,

i try out the p5 library (thumbs up Smiley )
i have a button in my control window.

how can i change its color?

controlP5.addButton("delete",10,110,950,80,20).setWindow(controlWindow);

this is the code for placing my button, but i did not find out how to change its color?

i thought of using a slider to change it dynamically.  

Controller mySlider1 = controlP5.addSlider("R1",0,255,20,420,100,10);
mySlider1.setWindow(controlWindow);

is there a way to get all this done just in the control Window?

Hope for help!!!

Re: change button color controlP5
Reply #1 - Jul 5th, 2008, 7:13pm
 
Button b = controlP5.addButton("delete",10,110,950,80,20);
b.setWindow(controlWindow);

controlP5.setColorBackground( color( 255,0,0 ) );

// setColorForeground
// setColorActive
// setColorLabel
// setColorValue

F
Re: change button color controlP5
Reply #2 - Jul 5th, 2008, 9:02pm
 
thanks to you, but when trying out i get this error:

/tmp/build19250.tmp/Temporary_8525_4581.java:62:2:62:7: Semantic Error: Type "Button" is imported on demand from package "controlP5" and package "java.awt".

/tmp/build19250.tmp/Temporary_8525_4581.java:127:3:127:25: Semantic Error: The type of the right sub-expression, "processing.core.PImage", is not assignable to the variable, of type "controlP5.Button".

Re: change button color controlP5
Reply #3 - Jul 6th, 2008, 12:57am
 
is there a way to set different background colors for different buttons / labels?

let's say the first button i red, the second green? at the moment i can just change the color for all labels...
Page Index Toggle Pages: 1