Hey guys! I am plotting a graph on a JPanel. Now when I print this JPanel only forty 40% of the graph is printed.. i mean less than 50% of the JPanel is printed from the very left of the screen ..

/*Handling the printing job*/
            if (event.getSource() == jButton4) {
                PrinterJob job = PrinterJob.getPrinterJob();
                /*code that renders contents to the page*/
                job.setPrintable(new Printable() {
                    public int print(Graphics g, PageFormat pf, int page) throws
                            PrinterException {
                        if (page > 0) {
                            return NO_SUCH_PAGE;
                        Graphics2D g2d = (Graphics2D) g;
                        g2d.translate(pf.getImageableX(), pf.getImageableY());
                        return PAGE_EXISTS;
                boolean doPrint = job.printDialog();
                if (doPrint) {
                    try {
                    } catch (PrinterException pe) {
                        javax.swing.JOptionPane.showMessageDialog(null, "Exception Caught", "Cannot render printing", javax.swing.JOptionPane.ERROR_MESSAGE);

plz suggest!

Guys you can see that even the coordinate axes are not covered !!

testD in the above snippet represents the JPanel on which I have plotted the graph.