FX2D renderer reporting lower case keys as upper case

Hello,

The FX2D renderer is reporting lower case key presses as upper case.

On my Windows 10 PC this code only prints upper case characters to the console:

import processing.javafx.*;

void setup()
  {
  size(100, 100, FX2D);
  }

void draw()
  {
  }

// Use one OR the other below.
// Comment out the one not in use.

void keyPressed()
  {
  println("keyPressed:", key);
  }

//Workaround:
//void keyTyped()
//  {
//  println("keyTyped:", key);  
//  }

It works fine with P2D!

I did find a reference and workaround in the old repository:
'key' variable is always uppercase in FX2D renderer · Issue #3938 · processing/processing · GitHub

:)

Yep, that matches the FX2D quirk people have hit before. If you need the actual typed character, keyTyped() is probably the safer callback; keyPressed() is giving you the normalized key value there.

You could convert uppercase letters to lowercase like this -

void keyPressed(){
  // Convert any uppercase letters to lowercase
  key = key >= 'A' && key <= 'Z' ? (char)(key | 32) : key;
  println(key);
}

This is pure Java so is independent of the renderer type.