本文整理了Java中javax.swing.JPanel.printAll()
方法的一些代码示例,展示了JPanel.printAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.printAll()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:printAll
暂无
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public static void printRaw
(PrintJob _job, Graphics _g, JPanel _p)
{
_p.printAll(_g);
/*
Component[] c=_p.getComponents();
for(int i=0;i<c.length;i++)
if(c[i].isVisible())
{
int x=c[i].getX();
int y=c[i].getY();
System.err.println("_g="+_g+" "+x+" "+y);
_g.translate(x,y);
c[i].print(_g);
_g.translate(-x,-y);
}
*/
}
代码示例来源:origin: stackoverflow.com
JPanel panel = new JPanel(new BorderLayout(), true);
panel.add(BorderLayout.NORTH, table1);
panel.add(BorderLayout.SOUTH, table2);
panel.printAll(g);
代码示例来源:origin: com.github.haifengl/smile-plot
/**
* Exports the plot to an image file.
* @param file the destination file.
* @throws IOException if an error occurs during writing.
*/
public void save(File file) throws IOException {
BufferedImage bi = new BufferedImage(contentPane.getWidth(), contentPane.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bi.createGraphics();
contentPane.printAll(g2d);
ImageIO.write(bi, FileChooser.getExtension(file), file);
}
代码示例来源:origin: com.github.haifengl/smile-plot
@Override
public int print(java.awt.Graphics g, PageFormat pf, int page) throws PrinterException {
if (page > 0) {
// We have only one page, and 'page' is zero-based
return NO_SUCH_PAGE;
}
Graphics2D g2d = (Graphics2D) g;
// 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
g2d.translate(pf.getImageableX(), pf.getImageableY());
// Scale plots to paper size.
double scaleX = pf.getImageableWidth() / contentPane.getWidth();
double scaleY = pf.getImageableHeight() / contentPane.getHeight();
g2d.scale(scaleX, scaleY);
// Disable double buffering
RepaintManager currentManager = RepaintManager.currentManager(this);
currentManager.setDoubleBufferingEnabled(false);
// Now we perform our rendering
contentPane.printAll(g);
// Enable double buffering
currentManager.setDoubleBufferingEnabled(true);
// tell the caller that this page is part of the printed document
return PAGE_EXISTS;
}
内容来源于网络,如有侵权,请联系作者删除!