Block the PApplet(Processing) closing action when ESC is pressed

Hey Guys,
How can i block the closing action when ESC is pressed?
The only way i found by myself was to overwrite the original closing method and creating a new one

public void exit(){

public void exitProcessing(){

Thank you.

1 Like

You need to clear it out first then you can call whatever you like …

void keyPressed() {
  if (key == ESC) {
    key = 0;
    println("no quit");
1 Like

Is there an other way to do this?

I guess you could change the source code …

as far as I know this is the recommended method to avoid the key being passed to the quit command.

Clearing the key or overriding the method are both good ways.

Is there any particular reason why you don’t want to use either of those?