當前位置: 首頁>>代碼示例>>Java>>正文


Java PrintPage類代碼示例

本文整理匯總了Java中org.netbeans.spi.print.PrintPage的典型用法代碼示例。如果您正苦於以下問題:Java PrintPage類的具體用法?Java PrintPage怎麽用?Java PrintPage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PrintPage類屬於org.netbeans.spi.print包,在下文中一共展示了PrintPage類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Paper

import org.netbeans.spi.print.PrintPage; //導入依賴的package包/類
Paper(PrintPage page, String name, Date lastModified) {
    myPage = page;
    myName = name;
    myLastModified = lastModified;

    myPaperWidth = Config.getDefault().getPaperWidth();
    myPaperHeight = Config.getDefault().getPaperHeight();
    myPageX = Config.getDefault().getPageX();
    myPageY = Config.getDefault().getPageY();
    myPageWidth = Config.getDefault().getPageWidth();
    myPageHeight = Config.getDefault().getPageHeight();

    myHasBorder = Config.getDefault().hasBorder();
    myBorderColor = Config.getDefault().getBorderColor();

    myIsPainting = true;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:Paper.java

示例2: getPages

import org.netbeans.spi.print.PrintPage; //導入依賴的package包/類
@Override
public PrintPage[][] getPages(final int paperWidthInPixels, final int paperHeightInPixels, final double pageZoomFactor) {
  final MMDPrintOptions printOptions = new MMDPrintOptions();
 
  if (pageZoomFactor < 0.1d) {
    printOptions.setScaleType(MMDPrintOptions.ScaleType.FIT_TO_SINGLE_PAGE);
  } else if (pageZoomFactor > 20.0d) {
    printOptions.setScaleType(MMDPrintOptions.ScaleType.ZOOM);
    printOptions.setScale(1.0d);
  } else {
    printOptions.setScaleType(MMDPrintOptions.ScaleType.ZOOM);
    printOptions.setScale(pageZoomFactor);
  }
  
  final com.igormaznitsa.mindmap.print.PrintPage[][] pages = new MMDPrint(this.mindMapPanel, paperWidthInPixels, paperHeightInPixels, printOptions).getPages();
  
  final PrintPage[][] result = new PrintPage[pages.length][];
  
  for (int i = 0; i < pages.length; i++) {
    result[i] = new PrintPage[pages[i].length];
    for (int p = 0; p < pages[i].length; p++) {
      result[i][p] = new PrintPageAdapter(pages[i][p]);
    }
  }
  return result;
}
 
開發者ID:raydac,項目名稱:netbeans-mmd-plugin,代碼行數:27,代碼來源:MMDGraphEditor.java

示例3: getPages

import org.netbeans.spi.print.PrintPage; //導入依賴的package包/類
public PrintPage[][] getPages(int pageWidth, int pageHeight, double pageZoom) {
    List<ComponentPage> pages = new ArrayList<ComponentPage>();
    JComponent component = getComponent();

    if (component == null) {
        return new PrintPage[0][0];
    }
    int componentWidth = component.getWidth();
    int componentHeight = component.getHeight();

    double zoom = getZoom(pageZoom, pageWidth, pageHeight, componentWidth, componentHeight);

    componentWidth = (int) Math.floor(componentWidth * zoom);
    componentHeight = (int) Math.floor(componentHeight * zoom);

    int row = 0;
    int column = 0;

    for (int h = 0; h < componentHeight; h += pageHeight) {
        row++;
        column = 0;

        for (int w = 0; w < componentWidth; w += pageWidth) {
            column++;
            Rectangle piece = new Rectangle((column - 1) * pageWidth, (row - 1) * pageHeight, pageWidth, pageHeight);
            pages.add(new ComponentPage(component, piece, zoom, row - 1, column - 1));
        }
    }
    PrintPage[][] printPages = new PrintPage[row][column];

    for (ComponentPage page : pages) {
        printPages[page.getRow()][page.getColumn()] = page;
    }
    return printPages;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:36,代碼來源:ComponentProvider.java

示例4: getPages

import org.netbeans.spi.print.PrintPage; //導入依賴的package包/類
@Override
public PrintPage[][] getPages(final int width, final int height, double d) {
    int printMaxHor = panel.getMaxWidth() / width + (panel.getMaxWidth() % width != 0 ? 1 : 0);
    int printMaxVert = panel.getMaxHeight() / height + (panel.getMaxHeight() % height != 0 ? 1 : 0);
    PrintPage[][] res = new PrintPage[printMaxHor][printMaxVert];
    for (int pv = 0; pv < printMaxVert; pv++) {
        for (int ph = 0; ph < printMaxHor; ph++) {
            final int pageHor = ph;
            final int pageVer = pv;
            PrintPage pp = new PrintPage() {
                @Override
                public void print(Graphics graphics) {
                    if (!(graphics instanceof Graphics2D)) {
                        return;
                    }
                    Graphics2D g2d = (Graphics2D) graphics;

                    AffineTransform tx = g2d.getTransform();

                    g2d.translate(-pageHor * width, -pageVer * height);

                    RepaintManager currentManager = RepaintManager.currentManager(panel);
                    currentManager.setDoubleBufferingEnabled(false);
                    g2d.setColor(Color.BLACK);
                    panel.paint(g2d);
                    currentManager.setDoubleBufferingEnabled(true);

                    g2d.setTransform(tx);
                }
            };
            res[pv][ph] = pp;
        }
    }
    return res;
}
 
開發者ID:vrsl,項目名稱:MDD-JPA,代碼行數:36,代碼來源:ErdModellerVisualElement.java

示例5: PrintPageAdapter

import org.netbeans.spi.print.PrintPage; //導入依賴的package包/類
public PrintPageAdapter(final com.igormaznitsa.mindmap.print.PrintPage delegate){
  this.delegate = delegate;
}
 
開發者ID:raydac,項目名稱:netbeans-mmd-plugin,代碼行數:4,代碼來源:PrintPageAdapter.java


注:本文中的org.netbeans.spi.print.PrintPage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。