Why cant I display the text of a string made with toString?


got this from the AP-Sync library. building a string that will be sent to Ardu when enter is pressed.

Works great, great library.
However, I want to also display that string on the java, so I can see what I am typing. println, shows it fine, but “text( toArduino, LS4+190, 70);” said that I cant show that.

I also tried to make a new string just for my text such as: String BeforeSending = toArduino;
Not allowed, I get a "Type mismatch, “java.lang.StringBuilder” does not match with “java.lang.String”

Here is the function

  if (keyCode == ENTER){
      println(toArduino + " sent");
      BeforeSending= "";
  if (keyCode == DELETE || keyCode == BACKSPACE){
      if(toArduino.length() > 0){
         toArduino.deleteCharAt(toArduino.length() - 1);

  if(keyCode != ENTER &&
      keyCode != DELETE &&
      keyCode != ESC &&
      keyCode != UP &&
      keyCode != DOWN &&
      keyCode != BACKSPACE &&
      keyCode != TAB &&
      keyCode != ALT &&
      keyCode != CONTROL &&
      keyCode != RETURN ){


Thanks a lot,


Hi laptophead, the value toArduino it reset as soon as you press “ENTER”


keep the value in another var before .setLength(0)

keep us to date …


Thanks that worked. Was obvious in retrospect