Dashed line at Java/Processing

This code is a little bit edited and re-posted again from a post I found on Processing forum. Check the source at the bottom of the post for the original post.
[java]
import java.awt.*;

float[] dashes = { 16.0f, 8.0f, 4.0f, 8.0f };
BasicStroke pen;

void setup(){
size(400, 400);
noLoop();
pen = new BasicStroke(4.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 4.0f, dashes, 0.0f);
Graphics2D g2 = ((PGraphicsJava2D) g).g2;
g2.setStroke(pen);
}

void draw(){
line(0, 0, width, height);
line(0, height, width, 0);
}
[/java]
source : http://processing.org/discourse/yabb2/YaBB.pl?board=Syntax;action=display;num=1217445670