Toolkit tk = Toolkit.getDefaultToolkit();Frame f=new Frame(); //dummy-Frame erzeugenf.show();Properties props=new Properties();PrintJob pj=tk.getPrintJob(f, "Print", props);Graphics g = pj.getGraphics();g.drawLine(0,0,100,100);pj.end();