本文整理了Java中javax.swing.JComponent.printAll()
方法的一些代码示例,展示了JComponent.printAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.printAll()
方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:printAll
暂无
代码示例来源:origin: stackoverflow.com
BufferedImage bi = new BufferedImage (example.getWidth(), example.getHeight(), BufferedImage.TYPE_BYTE_INDEXED);
Graphics2D g2d = bi.createGraphics();
example.printAll(g2d);
g2d.dispose();
代码示例来源:origin: stackoverflow.com
public int print(Graphics g, PageFormat pf, int page) throws PrinterException
{
if(page > 0) return Printable.NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D)g;
g2.translate(pf.getImageableX(), pf.getImageableY());
for(JComponent item : items)
{
g2.translate(item.getX(), item.getY());
item.printAll(g);
g2.translate(-item.getX(), -item.getY()); // bring all back to default coordinates
}
return Printable.PAGE_EXISTS;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* generates the actual output.
*
* @throws Exception if something goes wrong
*/
public void generateOutput() throws Exception {
BufferedImage bi;
Graphics g;
bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB);
g = bi.getGraphics();
g.setPaintMode();
g.setColor(getBackground());
if (g instanceof Graphics2D)
((Graphics2D) g).scale(getXScale(), getYScale());
g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight());
getComponent().printAll(g);
ImageIO.write(bi, "bmp", getFile());
}
代码示例来源:origin: stackoverflow.com
desktopPane.printAll(g2d);
g2d.dispose();
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* generates the actual output.
*
* @throws Exception if something goes wrong
*/
public void generateOutput() throws Exception {
BufferedImage bi;
Graphics g;
bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB);
g = bi.getGraphics();
g.setPaintMode();
g.setColor(getBackground());
if (g instanceof Graphics2D)
((Graphics2D) g).scale(getXScale(), getYScale());
g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight());
getComponent().printAll(g);
ImageIO.write(bi, "png", getFile());
}
代码示例来源:origin: Waikato/weka-trunk
/**
* generates the actual output.
*
* @throws Exception if something goes wrong
*/
public void generateOutput() throws Exception {
BufferedImage bi;
Graphics g;
bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB);
g = bi.getGraphics();
g.setPaintMode();
g.setColor(getBackground());
if (g instanceof Graphics2D)
((Graphics2D) g).scale(getXScale(), getYScale());
g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight());
getComponent().printAll(g);
ImageIO.write(bi, "bmp", getFile());
}
代码示例来源:origin: Waikato/weka-trunk
/**
* generates the actual output.
*
* @throws Exception if something goes wrong
*/
public void generateOutput() throws Exception {
BufferedImage bi;
Graphics g;
bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB);
g = bi.getGraphics();
g.setPaintMode();
g.setColor(getBackground());
if (g instanceof Graphics2D)
((Graphics2D) g).scale(getXScale(), getYScale());
g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight());
getComponent().printAll(g);
ImageIO.write(bi, "png", getFile());
}
代码示例来源:origin: stackoverflow.com
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2d.scale(scale, scale);
pane.printAll(g2d);
g2d.dispose();
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
private Image getComponentImage(JComponent component) {
// Initial component sizing & layout
component.setSize((getClientSize().width == 0) ? component.getPreferredSize() : getClientSize()); // try to fit the component to ComponentMorpher
component.doLayout(); // layout component
// Correct component sizing & layout
component.setSize(new Dimension(getClientSize().width, component.getPreferredSize().height)); // Width of component is fixed, update height
component.doLayout(); // layout component
// One more iteration because of nested JTextAreas
component.setSize(new Dimension(getClientSize().width, component.getPreferredSize().height)); // Width of component is fixed, update height
component.doLayout(); // layout component
// Paint component into BufferedImage
BufferedImage componentImage = new BufferedImage(component.getSize().width, component.getSize().height,
BufferedImage.TYPE_INT_RGB);
component.printAll(componentImage.getGraphics());
return componentImage;
}
代码示例来源:origin: stackoverflow.com
textArea.printAll(g2d);
g2d.dispose();
代码示例来源:origin: stackoverflow.com
BufferedImage img = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB);
Graphics g = img.getGraphics();
textArea.printAll(g);
g.dispose();
displayImg(img);
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
getComponent().printAll(g);
代码示例来源:origin: Waikato/weka-trunk
getComponent().printAll(g);
代码示例来源:origin: stackoverflow.com
parent.printAll(g2d);
g2d.dispose();
代码示例来源:origin: stackoverflow.com
PrintTest.this.printAll(g);
return Printable.PAGE_EXISTS;
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
psg.setFont(getComponent().getFont());
psg.scale(getXScale(), getYScale());
getComponent().printAll(psg);
psg.finished();
代码示例来源:origin: stackoverflow.com
component.printAll(g2d);
g2d.translate(0, +yOffset);
Shape footerArea = new Rectangle2D.Double(0, height, pageFormat.getImageableWidth(), footerHeight);
代码示例来源:origin: Waikato/weka-trunk
psg.setFont(getComponent().getFont());
psg.scale(getXScale(), getYScale());
getComponent().printAll(psg);
psg.finished();
代码示例来源:origin: stackoverflow.com
view.printAll(g2d);
g2d.dispose();
代码示例来源:origin: stackoverflow.com
this.setSize(w, h);
this.validate();
this.printAll(g2d);
return PAGE_EXISTS;
内容来源于网络,如有侵权,请联系作者删除!