Depends on how you are creating graphics. The Graphics class has a drawLine method.