the serial port can only be used by one app,
so you close the arduino IDE serial monitor
open the processing and run the example from serial library like
https://processing.org/reference/libraries/serial/serialEvent_.html
so all the arduino sends will be printed to canvas.
that was the easy part, if you want use keypressed and send to arduino some Strings
it is a little bit longer way.