本文整理了Java中javax.swing.JComponent.print()
方法的一些代码示例,展示了JComponent.print()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.print()
方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:print
暂无
代码示例来源:origin: stackoverflow.com
jep.print(graphics);
代码示例来源:origin: nl.cloudfarming.client/cloudfarming-client-geoviewer-jxmap
public static BufferedImage createImage(JComponent component, int imageType) {
Dimension componentSize = component.getPreferredSize();
component.setDoubleBuffered(false);
component.setSize(componentSize);
component.validate();
BufferedImage img = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(component.getSize().width,
component.getSize().height, imageType);
Graphics2D grap = img.createGraphics();
component.print(grap);
grap.dispose();
return img;
}
代码示例来源:origin: stackoverflow.com
Graphics g = img.getGraphics();
g.translate(-headerRect.width, 0);
table.getTableHeader().print(g);
frame.add(new JLabel(new ImageIcon(img)), BorderLayout.SOUTH);
frame.pack();
代码示例来源:origin: stackoverflow.com
BufferedImage bufImage = new BufferedImage(p.getWidth(), p.getHeight(), java.awt.image.BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = bufImage.createGraphics();
p.print(graphics);
graphics.dispose();
try {
代码示例来源:origin: stackoverflow.com
BufferedImage bi = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics g = bi.createGraphics();
panel.print(g);
g.dispose();
try {
代码示例来源:origin: stackoverflow.com
BufferedImage.TYPE_INT_RGB );
Graphics2D g2d = image.createGraphics ();
comp.print ( g2d );
g2d.dispose ();
代码示例来源:origin: stackoverflow.com
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
tp.print(g2d);
g2d.dispose();
tp.setSize(original);
代码示例来源:origin: stackoverflow.com
BufferedImage image = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()
.createCompatibleImage(WIDTH, HEIGHT, BufferedImage.TRANSLUCENT);
circle.print(image.getGraphics());
images.add(image);
代码示例来源:origin: stackoverflow.com
start = System.currentTimeMillis();
buffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
this.print(buffer.getGraphics());// Draw the current components on the buffer
isFading = true;
final int timeInMillis = time * 1000;
代码示例来源:origin: org.xhtmlrenderer/core-renderer
public void paintReplacedElement(RenderingContext c, BlockBox box) {
ReplacedElement replaced = box.getReplacedElement();
if (replaced instanceof SwingReplacedElement) {
Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c);
translate(contentBounds.x, contentBounds.y);
JComponent component = ((SwingReplacedElement)box.getReplacedElement()).getJComponent();
component.print(_graphics);
translate(-contentBounds.x, -contentBounds.y);
} else if (replaced instanceof ImageReplacedElement) {
Image image = ((ImageReplacedElement)replaced).getImage();
Point location = replaced.getLocation();
_graphics.drawImage(
image, (int)location.getX(), (int)location.getY(), null);
}
}
代码示例来源:origin: stackoverflow.com
if (pageIndex == 0) {
g.translate((int) pageFormat.getImageableX(), (int) pageFormat.getImageableY());
panel.print(g);
return PAGE_EXISTS;
代码示例来源:origin: Geomatys/geotoolkit
/**
* Takes a screenshot of the currently active component.
*/
private void screenshot() {
final JComponent active = this.active;
if (active != null && active.isValid()) {
final BufferedImage image = new BufferedImage(active.getWidth(), active.getHeight(), BufferedImage.TYPE_INT_RGB);
final Graphics2D handler = image.createGraphics();
active.print(handler);
handler.dispose();
File file = new File(Preferences.userNodeForPackage(DesktopPane.class).get(SCREENSHOT_DIRECTORY_PREFS, "."));
file = new File(file, getTitle(active.getClass()) + ".png");
try {
assertTrue(ImageIO.write(image, "png", file));
file = file.getParentFile();
Desktop.getDesktop().open(file);
} catch (IOException e) {
JOptionPane.showInternalMessageDialog(active, e.getLocalizedMessage(),
e.getClass().getSimpleName(), JOptionPane.ERROR_MESSAGE);
}
} else {
JOptionPane.showInternalMessageDialog(this, "No active window.", "Screenshot", JOptionPane.WARNING_MESSAGE);
}
}
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
public void dragGestureRecognized(DragGestureEvent dge) {
// Acquire locks
acquireLocks();
// Start Drag
dge.startDrag(Cursor.getDefaultCursor(),
createTransferable(),
this);
// Fire startDrag Event
descriptor.getToolBar().propertyChange(new PropertyChangeEvent(getComponent(), "startDrag", null, dge));
// Setup ghostImage
if (descriptor.getResourceManager().getBoolean("drag.icon.useDefault", false)) {
setGhostImage(dge.getDragOrigin(),
descriptor.getResourceManager().getBufferedImage(MyDoggyKeySpace.DRAG));
} else {
JComponent representativeAnchor = descriptor.getRepresentativeAnchor();
BufferedImage ghostImage = new BufferedImage(representativeAnchor.getWidth(),
representativeAnchor.getHeight(),
BufferedImage.TYPE_INT_RGB);
representativeAnchor.print(ghostImage.createGraphics());
setGhostImage(dge.getDragOrigin(), ghostImage);
}
lastAnchor = null;
}
代码示例来源:origin: stackoverflow.com
header.print(g2d);
table.print(g2d);
代码示例来源:origin: Geomatys/geotoolkit
final Graphics2D gr = image.createGraphics();
try {
component.print(gr);
} finally {
gr.dispose();
内容来源于网络,如有侵权,请联系作者删除!