aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Printing Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Printing Question" Watch "Printing Question" New topic

Printing Question

Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
I have an object which implements Printable and can be drawn on any Graphics2D (including the one you can get from the Java printing API).
This is the print method

But when I launched the printing, nothing is printed.(Page is white)
Q) How to implement the print method to print the object
Thank you
[ May 05, 2003: Message edited by: Garandi Garandi ]
satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
U have to write the code that u want to print inside the print method. Say for u have some squares drawing in the Paint method. Same code u have to write in the Print method.
void Paint()
Graphics2D g2D=(Graphics2D)g;
Rectangle rect = newRectangle(10,10,20,20);
public int print(Graphics g,PageFormat pageFormat,int pageIndex)throws PrinterException
return NO_SUCH_PAGE;
Graphics2D g2D=(Graphics2D)g;

Rectangle rect = newRectangle(10,10,20,20);

I agree. Here's the link:
subject: Printing Question
Similar Threads
Record locking must be implemented using the methods public void lock(int) and public
when to use lock(-1) method
program correction
Printing problem
Printable interface