Link to home
Start Free TrialLog in
Avatar of crisoft
crisoft

asked on

Printing in Java

How can I send something to the printer?

Supose you have a window with a text in it and you want it to be printed.

thanks
cristian
ASKER CERTIFIED SOLUTION
Avatar of zia777
zia777

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of crisoft
crisoft

ASKER

I have a question:
I don´t know what is and how to use the container object. Can you give me a complete example using it?

thank you very much
cristian



1. import java.awt.*;
2. Toolkit tk = Toolkit.getDefaultToolkit();
3. PrintJob pj = tk.getPrintJob(container object,"title",null);
4. Graphics g = pj.getGraphics(container object);
5. container Object.printAll(g);
6. g.dispose();