How to have a different font size inside the text field than the font size of its description with ControlP5?

I’d like to add a textfield named “input”. The description (“input”) should be of font size 5 but inside the text field I’d like to use a font size that fills out most of the text field. In any case, I’d like the font size for inside the text field to be bigger than 5.

This is how I’m coding the text field. How can I adjust the text sizes for the text field description and the text field input independently?

    .setPosition(20, 100)
    .setSize(200, 40)
    .setFont(createFont("ArialCE.ttf", 5, true))
    .setColor(color(255, 0, 0))

Did you check the examples and stuff on the website please?

The controlp5 Website?

1 Like

I couldn’t find anything in the documentation but I did find something here: How to change the defauld settings of the label of a textfield using Controlp5 library - Processing 2.x and 3.x Forum

  cp5 = new ControlP5(this);
  PFont font = createFont("arial",20);
  Textfield t = cp5.addTextfield("textValue")
  Label label = t.getCaptionLabel(); 
1 Like

Hi @tea_tree

It is possible if you call the right part of the controller
Please find the code below for your case. Hope it helps :slight_smile:

import controlP5.*;

ControlP5 cp5;

String textValue = "";

void setup() {
  PFont font = createFont("arial",20);
  PFont controlFont = createFont("arial", 5);
  cp5 = new ControlP5(this);
  cp5.getController("input").getCaptionLabel().setFont(new ControlFont(controlFont)); //set the font of the caption label.
  //you can also use this same method to set the font for the textarea instead of using .setFont() in the definition of the controller object.
  //cp5.getController("input").getValueLabel().setFont(new ControlFont(font));

void draw() {
  text(cp5.get(Textfield.class,"input").getText(), 360,130);
  text(textValue, 360,180);

public void clear() {

void controlEvent(ControlEvent theEvent) {
  if(theEvent.isAssignableFrom(Textfield.class)) {
    println("controlEvent: accessing a string from controller '"
            +theEvent.getName()+"': "

public void input(String theText) {
  // automatically receives results from controller input
  println("a textfield event for controller 'input' : "+theText);

Best regards