Array input field

I have a question about input fields(I’m using the ones from controlp5) and was asking myself if you can have it so, that every entry in that field are integers and also added to an array. Thank you for your help

Edit: As my project is a decoder, it would have to be editable with a keyboard.


You can use the function yourString.split("") to parse the input string of your text field and then convert each string number into integers with Integer.parseInt(yourString).

Here is the complete example (adapted from the ControlP5 Textfield example:

import controlP5.*;
import java.util.Arrays;

ControlP5 cp5;
int[] arrayTextField;

void setup() {
  PFont font = createFont("arial",30);
  cp5 = new ControlP5(this);

void draw() {

public void input(String theText) {
  //Splitting the numbers
  String[] splittedText = theText.split("");
  arrayTextField = new int[splittedText.length];
  //Inserting them into the array
  for(int i=0;i<splittedText.length;i++){
    arrayTextField[i] = Integer.parseInt(splittedText[i]);
  //Printing the array

Hey There!

There are different types that the things can be in the field :

In textfieldInput