Package java.awt

Examples of java.awt.Graphics2D.translate()


        }
        else {
            // shift Graphic to line up with beginning of print-imageable region
            g2.translate(pf.getImageableX(), pf.getImageableY());
            // shift Graphic to line up with beginning of next page to print
            g2.translate(0f, -pageIndex * pageHeight);
            // scale the page so the width fits...
            g2.scale(scale, scale);
            // for faster printing, turn off double buffering
            disableDoubleBuffering(componentToBePrinted);
            componentToBePrinted.paint(g2); //repaint the page for printing
View Full Code Here


        /* User (0,0) is typically outside the imageable area, so we must
         * translate by the X and Y values in the PageFormat to avoid clipping
         */
        Graphics2D g2d = (Graphics2D) graphics;
        g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());

        /* Now we perform our rendering */
        graphics.drawImage(this.bufferedImage.get(), 0, 0, null);

        /* tell the caller that this page is part of the printed document */
 
View Full Code Here

      if( subPageIndex == subTableSplitSize -1) {
          subPageIndex=0;
      }
    }
    g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    int rowIndex = pageIndex/ (subTableSplitSize -1);
        
    printTablePart(g2, pageFormat, rowIndex, subPageIndex);
    prevPageIndex= pageIndex;
View Full Code Here

            double scale = display.getDisplayHost().getScale();
            if (scale != 1) {
                graphics.scale(scale, scale);
            }

            graphics.translate(x, y);
            graphics.clipRect(0, 0, getWidth(), getHeight());
        }

        return graphics;
    }
View Full Code Here

                        - (pageFormat.getImageableWidth() * reduceFactor * (pagesPerRow - 1)));
        //
        System.err.println("[GanttPrintable] print(): height=" + height
                + " width=" + width);
        Graphics2D g2d = (Graphics2D) graphics;
        g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());

        BufferedImage subimage = image.getSubimage(leftx, topy, width, height);
        int h = (int) (subimage.getHeight() / reduceFactor);
        int w = (int) (subimage.getWidth() / reduceFactor);

View Full Code Here

      g2D.setTransform(oldTransform);
      g2D.setClip(clipBounds);
      g2D.setFont(this.headerFooterFont);
      g2D.setColor(Color.BLACK);
      if (this.fixedHeaderLabel != null) {
        g2D.translate(xFixedHeader, yFixedHeader);
        this.fixedHeaderLabel.print(g2D);
        g2D.translate(-xFixedHeader, -yFixedHeader);
      }
      if (header != null) {
        g2D.drawString(header, xHeader, yHeader);
View Full Code Here

      g2D.setFont(this.headerFooterFont);
      g2D.setColor(Color.BLACK);
      if (this.fixedHeaderLabel != null) {
        g2D.translate(xFixedHeader, yFixedHeader);
        this.fixedHeaderLabel.print(g2D);
        g2D.translate(-xFixedHeader, -yFixedHeader);
      }
      if (header != null) {
        g2D.drawString(header, xHeader, yHeader);
      }
      if (footer != null) {
View Full Code Here

      }
      if (footer != null) {
        g2D.drawString(footer, xFooter, yFooter);
      }
      if (this.fixedFooterLabel != null) {
        g2D.translate(xFixedFooter, yFixedFooter);
        this.fixedFooterLabel.print(g2D);
        g2D.translate(-xFixedFooter, -yFixedFooter);
      }
    } 
    pageFormat.setPaper(oldPaper);   
View Full Code Here

        g2D.drawString(footer, xFooter, yFooter);
      }
      if (this.fixedFooterLabel != null) {
        g2D.translate(xFixedFooter, yFixedFooter);
        this.fixedFooterLabel.print(g2D);
        g2D.translate(-xFixedFooter, -yFixedFooter);
      }
    } 
    pageFormat.setPaper(oldPaper);   
    return pageExists;
  }
View Full Code Here

        }
      }
 
      Graphics2D g2D = (Graphics2D)g.create();
      // Center the 3D view in component
      g2D.translate(pageFormat.getImageableX() + (pageFormat.getImageableWidth() - printSize) / 2,
          pageFormat.getImageableY() + (pageFormat.getImageableHeight() - printSize) / 2);
      double scale = printSize / printedImageSize;
      g2D.scale(scale, scale);
      g2D.drawImage(this.printedImage, 0, 0, this);
      g2D.dispose();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.