本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例5: PrintPageAdapter
import org.netbeans.spi.print.PrintPage; //导入依赖的package包/类
public PrintPageAdapter(final com.igormaznitsa.mindmap.print.PrintPage delegate){
this.delegate = delegate;
}