Printing Components on a JPanel

I have application that displays JLabels with Images on a JPanel. The JPanel layout is set to NULL so I can arrange the JLabels on the panel using the mouse. This all works. However, after arranging the JLabels on the JPanel, I would like to printout the arrangement.

Can someone tell me how to do this? When I tried sample code I've seen on this forum, it seems the panel and its components are print over and over again until the end of the page. So it looks like overlays every 1/2 inch.

Here is the code i've tried for the print method:

public int print(Graphics g, PageFormat pf, int pi) throws PrinterException

{

if (pi > 0) {

return(NO_SUCH_PAGE);

} else {

Graphics2D g2d = (Graphics2D)g;

g2d.translate(pf.getImageableX(), pf.getImageableY());

paintAll(g2d);

return(PAGE_EXISTS);

}

}

Thanks in advance for the help.

augie

[931 byte] By [augie98] at [2007-9-27 21:28:06]
# 1
Can anyone help at all?
augie98 at 2007-7-7 3:23:46 > top of Java-index,Archived Forums,Java Programming...
# 2
Can anyone help with this problem at all.
augie98 at 2007-7-7 3:23:46 > top of Java-index,Archived Forums,Java Programming...
# 3
Instead of using the java.awt.Component.paintAll method, try the javax.swing.JComponent.paint method and see if it solves your problem.;o)V.V.
viravan at 2007-7-7 3:23:46 > top of Java-index,Archived Forums,Java Programming...