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.
import java.awt.*;

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

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

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