Display data on processing

Processing

 cp5.addTextfield("Current RPM")
    .setFont(font1)
    .setPosition(700, 600)
    .setSize(250,100);
     
}
void serialEvent( Serial port) {
  val = port.readStringUntil('\n');
  if (val != null) {
    val = trim(val);
    y=int(val);
    println(y); 
    x.setText(str(y));
  }

I am trying to display current RPM on GUI. I recieve the data from arduino and can print it on the console but can't display on interface

This is a Processing question, NOT an Arduino question.

But, you add a text field, but you don't seem to capture the output of the function, so you have no object to call the setText() method of. Yet, you seem to think that x is such an object. I have to wonder why.

There IS a reason we do NOT want to see just snippets here. And, now you know why.