Textfield controIP5
in
Contributed Library Questions
•
2 years ago
I want to use a textfield in my program.
I found this, but how can I change the color of my field. I can only change the background now.
Here the code:
- /**
- * ControlP5 Textflied.
- * by andreas schlegel, 2009
- */
- import controlP5.*;
- ControlP5 controlP5;
- String textValue = "";
- Textfield myTextfield;
- void setup() {
- size(400, 400);
- frameRate(25);
- controlP5 = new ControlP5(this);
- myTextfield = controlP5.addTextfield("Antwoord", 100, 160, 200, 20);
- myTextfield.setFocus(true);
- }
- void draw() {
- background(0);
- }
- void controlEvent(ControlEvent theEvent) {
- println(theEvent.controller().name()+": "+theEvent.controller().stringValue());
- }
1