[nbj2ee] BufferedImage drawImage problem

  • From: "ralieghnet" < >
  • To:
  • Subject: [nbj2ee] BufferedImage drawImage problem
  • Date: Thu, 24 Jan 2013 12:37:46 -0500

I'm trying to call Google static maps in my program. The problem that I'm 
facing is the program will display the map with no problem in the iconImage 
in my form, but when I try to print the map to PDF or printer it does not 
display. 


Code:
@Override
        public int print(Graphics g, PageFormat pageFormat, int pageIndex) 
throws PrinterException {
            try {
                double[] results;
                
                Graphics2D g2d = (Graphics2D) g;
                
                g2d.translate(pageFormat.getImageableX(), 
pageFormat.getImageableY());
                
                g2d.setPaint(Color.BLACK);
                g2d.setStroke(new BasicStroke(1));
                
                Rectangle2D.Double border = new Rectangle2D.Double(0, 0, 
pageFormat.getImageableWidth(), pageFormat.getImageableHeight());
                g2d.draw(border);
                g2d.dispose();
                results = calculate(master,slave);
                
                if (count < 1) {
                    System.out.println("Print " + count);
                    map.setSize("400x400");
                    map.setScale(1);
                    map.setCordinates(results[0], results[1], results[2], 
results[3]);
                    
                    BufferedImage img = map.getImage();
                    BufferedImage bi = new BufferedImage(400, 400, 
BufferedImage.TYPE_INT_RGB);
                    g2d = bi.createGraphics();
                    g2d.drawImage(img, 36, 36, null);
                    g2d.dispose();

                }
                
                count++;
                return(PAGE_EXISTS);
            } catch (IOException ex) {
                Logger.getLogger(print.class.getName()).log(Level.SEVERE, 
null, ex);
                return (PAGE_EXISTS);
            }
        }









[nbj2ee] BufferedImage drawImage problem

ralieghnet 01/24/2013

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close