Take notice Processing already provides many functions that return a File object, which can be invoked as soon as callback settings():
dataFile(): PApplet
sketchFile(): PApplet
saveFile(): PApplet
Any of those 3 functions can be used as the 3rd argument for selectFolder(): PApplet