Here are the steps to get your code looking like this in self posts and comments:
In Processing's menu bar, click "Edit -> Auto Format".
In Processing's menu bar, click "Edit -> Select All".
In processing's menu bar, click "Edit -> Increase Indent".
In Processing's menu bar, click "Edit -> Increase Indent". (again)
Copy your sketch and paste into a self post or comment.
The trick here is that reddit expects each line of code to have four spaces in front of it. Each time you "Increase Indent", Processing will add two spaces to the beginning of each line. The result should look something like this:
void setup () {
size(WIDTH,WIDTH);
frameRate(60);
background(0);
noStroke();
smooth();
}
A couple of other tips:
If you want to include some text before your code (as I've done on this post), you'll need to separate the text from the code with a newline.
Install Reddit Enhancement Suite onto your browser and it will show you a live preview of your post as you type it, so that you can be sure that your formatting is working as expected.