Some previous posts related to retrieving data via serial in Processing:
- https://forum.processing.org/two/discussion/16618/processing-with-arduino-void-serialevent#Item_1
- https://forum.processing.org/two/discussion/18922/urgent-in-need-of-help-with-processing-code-srf10-ultrasonic-sensor/p1
- https://forum.processing.org/two/discussion/21447/two-sensors-trigger-same-part-of-code#latest
- https://forum.processing.org/two/discussion/comment/88115/#Comment_88115
Take the one that is the closest related to your task and try to understand it. Then modify your code and show your attempt. If you have specific questions, just ask them. There are are also also online tutorial with videos and I find they are excellent resources to get started in this kind of projects.
Kf