当前位置: 首页>>代码示例>>Java>>正文


Java PrinterJob.pageDialog方法代码示例

本文整理汇总了Java中java.awt.print.PrinterJob.pageDialog方法的典型用法代码示例。如果您正苦于以下问题:Java PrinterJob.pageDialog方法的具体用法?Java PrinterJob.pageDialog怎么用?Java PrinterJob.pageDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.print.PrinterJob的用法示例。


在下文中一共展示了PrinterJob.pageDialog方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
/**
 * 
 */
public void actionPerformed(ActionEvent e)
{
	if (e.getSource() instanceof mxGraphComponent)
	{
		mxGraphComponent graphComponent = (mxGraphComponent) e
				.getSource();
		PrinterJob pj = PrinterJob.getPrinterJob();
		PageFormat format = pj.pageDialog(graphComponent
				.getPageFormat());

		if (format != null)
		{
			graphComponent.setPageFormat(format);
			graphComponent.zoomAndCenter();
		}
	}
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:21,代码来源:EditorActions.java

示例2: showPageSetup

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
public boolean showPageSetup() {
    PrinterJob job = PrinterJob.getPrinterJob();
    PageFormat oldFormat = getPageFormat();
    PageFormat newFormat = job.pageDialog(oldFormat);

    if (oldFormat == newFormat) {
        return false;
    }
    myPageFormat = newFormat;

    // save
    set(PAGE_ORIENTATION, myPageFormat.getOrientation());
    Paper paper = myPageFormat.getPaper();

    set(PAPER_WIDTH, paper.getWidth());
    set(PAPER_HEIGHT, paper.getHeight());

    set(AREA_X, paper.getImageableX());
    set(AREA_Y, paper.getImageableY());

    set(AREA_WIDTH, paper.getImageableWidth());
    set(AREA_HEIGHT, paper.getImageableHeight());

    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:Config.java

示例3: getCustomEditor

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
/**
* @return <tt>null</tt> Shows pageDialog, however.
*/
public java.awt.Component getCustomEditor() {
    PageFormat pf = (PageFormat) getValue();
    PrinterJob pj = PrinterJob.getPrinterJob();
    PageFormat npf = pj.pageDialog(pf);

    //setValue(npf);
    ((PrintSettings)PrintSettings.findObject(PrintSettings.class)).setPageFormat((PageFormat) npf.clone());
    pj.cancel();

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:PrintSettings.java

示例4: createChartPrintJob

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
/**
 * Creates a print job for the chart.
 */

@Override
public void createChartPrintJob() {

	PrinterJob job = PrinterJob.getPrinterJob();
	PageFormat pf = job.defaultPage();
	PageFormat pf2 = job.pageDialog(pf);
	if (pf2 != pf) {
		job.setPrintable(this, pf2);
		if (job.printDialog()) {
			try {
				job.print();
			} catch (PrinterException e) {
				JOptionPane.showMessageDialog(this, e);
			}
		}
	}

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:AbstractChartPanel.java

示例5: actionPerformed

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent event) {
    if (event.getSource() == _fillButton) {
        fillPlot();
    }
    else if (event.getSource() == _printButton) {
        PrinterJob job = PrinterJob.getPrinterJob();
        // [email protected]: Get the Page Format and use it.
        PageFormat format = job.pageDialog( job.defaultPage() );
        job.setPrintable(PlotBox.this, format);
        if (job.printDialog()) {
            try {
                job.print();
            } catch (Exception ex) {
                Component ancestor = getTopLevelAncestor();
                JOptionPane.showMessageDialog(ancestor,
                        "Printing failed:\n" + ex.toString(),
                        "Print Error", JOptionPane.WARNING_MESSAGE);
            }
        }
    }
    else if (event.getSource() == _resetButton) {
        resetAxes();
    }
    else if (event.getSource() == _formatButton) {
        PlotFormatter fmt = new PlotFormatter(PlotBox.this);
        fmt.openModal();
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:29,代码来源:PlotBox.java

示例6: createChartPrintJob

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
/**
 * Creates a print job for the chart.
 */
public void createChartPrintJob() {

    PrinterJob job = PrinterJob.getPrinterJob();
    PageFormat pf = job.defaultPage();
    PageFormat pf2 = job.pageDialog(pf);
    if (pf2 != pf) {
        job.setPrintable(this, pf2);
        if (job.printDialog()) {
            try {
                job.print();
            }
            catch (PrinterException e) {
                JOptionPane.showMessageDialog(this, e);
            }
        }
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:ChartPanel.java

示例7: createChartPrintJob

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
/**
 * Creates a print job for the chart.
 */
public void createChartPrintJob() {
    //FIXME try to replace swing print stuff by swt
    PrinterJob job = PrinterJob.getPrinterJob();
    PageFormat pf = job.defaultPage();
    PageFormat pf2 = job.pageDialog(pf);
    if (pf2 != pf) {
        job.setPrintable(this, pf2);
        if (job.printDialog()) {
            try {
                job.print();
            }
            catch (PrinterException e) {
                MessageBox messageBox = new MessageBox( 
                        canvas.getShell(), SWT.OK | SWT.ICON_ERROR );
                messageBox.setMessage( e.getMessage() );
                messageBox.open();
            }
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:ChartComposite.java

示例8: main

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        String[] instructions =
         {
             "Visual inspection of the dialog is needed. ",
             "It should be a Printer Job Setup Dialog",
             "Do nothing except Cancel",
             "You must NOT press OK",
         };
        SwingUtilities.invokeAndWait(() -> {
            JOptionPane.showMessageDialog(
                    (Component) null,
                    instructions,
                    "information", JOptionPane.INFORMATION_MESSAGE);
        });
        PrinterJob pj = PrinterJob.getPrinterJob();
        PrintRequestAttributeSet pSet = new HashPrintRequestAttributeSet();
        pSet.add(DialogTypeSelection.NATIVE);
        if ((pj.pageDialog(pSet)) != null) {
            throw
            new RuntimeException("PrinterJob.pageDialog(PrintRequestAttributeSet)"
                        + " does not return null when dialog is cancelled");
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:PageDlgApp.java

示例9: pageDialogExample

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
public void pageDialogExample() throws PrinterException
{
    PrinterJob job = PrinterJob.getPrinterJob();
    PageFormat originalPageFormat = job.defaultPage();
    PageFormat pageFormat = job.pageDialog(originalPageFormat);

    if(originalPageFormat == pageFormat) return;

    job.setPrintable(this,pageFormat);
    job.print();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:PageDlgPrnButton.java

示例10: actionPerformed

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
/**
 * 
 */
public void actionPerformed(ActionEvent e) {
  if (e.getSource() instanceof mxGraphComponent) {
    mxGraphComponent graphComponent = (mxGraphComponent) e.getSource();
    PrinterJob pj = PrinterJob.getPrinterJob();
    PageFormat format = pj.pageDialog(graphComponent.getPageFormat());

    if (format != null) {
      graphComponent.setPageFormat(format);
      graphComponent.zoomAndCenter();
    }
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:16,代码来源:EditorActions.java

示例11: main

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
    String[] instructions
            = {
                "Page Dialog will be shown.",
                "Change top(in) margin value from 1.0 to 2.0",
                "Then select OK."
            };
    SwingUtilities.invokeAndWait(() -> {
        JOptionPane.showMessageDialog((Component) null,
                instructions, "Instructions",
                JOptionPane.INFORMATION_MESSAGE);
    });
    PrinterJob pj = PrinterJob.getPrinterJob();
    try {
        HashPrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        PageFormat pf;
        pf = pj.pageDialog(aset);
        double left = pf.getImageableX();
        double top = pf.getImageableY();
        System.out.println("pageDialog - left/top from pageFormat: " + left / 72
                + " " + top / 72);
        System.out.println("pageDialog - left/top from attribute set: "
                + getPrintableXFromASet(aset) + " "
                + getPrintableYFromASet(aset));
        if (top / 72 != 2.0f || getPrintableYFromASet(aset) != 2.0f) {
            throw new RuntimeException("Top margin value not updated");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:PageDialogMarginTest.java

示例12: main

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
public static void main(String args[]) {
    PrinterJob job = PrinterJob.getPrinterJob();
    if (job == null) {
        return;
    }
    PrintRequestAttributeSet pSet =
         new HashPrintRequestAttributeSet();
    pSet.add(DialogTypeSelection.NATIVE);
    job.printDialog(pSet);
    try {
        job.pageDialog(pSet);
    } catch (StackOverflowError e) {
        throw new RuntimeException("StackOverflowError is thrown");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:PageDlgStackOverflowTest.java

示例13: pageMarginTest

import java.awt.print.PrinterJob; //导入方法依赖的package包/类
public static void pageMarginTest() {
    PrinterJob pj = PrinterJob.getPrinterJob();
    HashPrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    PageFormat pf;
    pf = pj.pageDialog(aset);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:PageDialogMarginValidation.java


注:本文中的java.awt.print.PrinterJob.pageDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。