本文整理了Java中java.awt.Container.paint()
方法的一些代码示例,展示了Container.paint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.paint()
方法的具体详情如下:
包路径:java.awt.Container
类名称:Container
方法名:paint
[英]Paints the container. This forwards the paint to any lightweight components that are children of this container. If this method is reimplemented, super.paint(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clipping setting in g, paint() will not be forwarded to that child.
[中]油漆容器。这会将油漆转发到此容器的子级的任何轻型组件。如果此方法被重新实现,超级。应调用paint(g),以便正确渲染轻质组件。如果子组件被g中的当前剪裁设置完全剪裁,则paint()将不会转发给该子组件。
代码示例来源:origin: stackoverflow.com
Container c = getContentPane();
BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
c.paint(im.getGraphics());
ImageIO.write(im, "PNG", new File("shot.png"));
代码示例来源:origin: nodebox/nodebox
public void takeScreenshot(File outputFile) {
Container c = getContentPane();
BufferedImage img = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = img.createGraphics();
c.paint(g2);
try {
ImageIO.write(img, "png", outputFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: mapsforge/mapsforge
@Override
public void paint(Graphics graphics) {
super.paint(graphics);
GraphicContext graphicContext = AwtGraphicFactory.createGraphicContext(graphics);
this.frameBuffer.draw(graphicContext);
if (this.mapScaleBar != null) {
this.mapScaleBar.draw(graphicContext);
}
this.fpsCounter.draw(graphicContext);
}
代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking
private void startDrag() {
Container parent = getParent();
if(paintBackgroundUnderDragRect) { // 2007/02/27
if(desktopImage == null || (desktopImage.getWidth() != parent.getWidth()) || (desktopImage.getHeight() != parent.getHeight())) {
desktopImage = (BufferedImage) parent.createImage(parent.getWidth(), parent.getHeight());
subImage = null;
}
Graphics g = desktopImage.getGraphics();
parent.paint(g);
g.dispose();
}
}
代码示例来源:origin: net.sf.ingenias/ingeniasjgraphmod
/**
* Overrides <code>Container.paint</code> to paint the node's
* icon and use the selection color for the background.
*/
public void paint(Graphics g) {
Dimension size = getSize();
// Then the icon.
if (editingIcon != null) {
int yLoc = 0;
int xLoc = 0;
editingIcon.paintIcon(this, g, xLoc, yLoc);
}
// Border selection color
Color background = getBorderSelectionColor();
if (background != null) {
g.setColor(background);
g.drawRect(0, 0, size.width - 1, size.height - 1);
}
super.paint(g);
}
代码示例来源:origin: net.sf.jt400/jt400
public void paint(Graphics gc)
{
Rectangle pos = passwordLabel_.getBounds();
int left = pos.x/2;
int top = pos.height/2 + pos.y;
int right = (getBounds().width + confirmTextField_.getBounds().x + confirmTextField_.getBounds().width) / 2;
int bottom = (centeringPanel_.getBounds().y + confirmTextField_.getBounds().y + confirmTextField_.getBounds().height) / 2;
gc.setColor(Color.white); // Use white to make it look bevelled!
gc.drawRect(left+1, top+1, right-left, bottom-top);
gc.setColor(Color.black);
gc.drawRect(left, top, right-left, bottom-top);
super.paint(gc);
}
代码示例来源:origin: cpesch/RouteConverter
public void paint(Graphics graphics) {
super.paint(graphics);
GraphicContext graphicContext = AwtGraphicFactory.createGraphicContext(graphics);
frameBuffer.draw(graphicContext);
fpsCounter.draw(graphicContext);
mapScaleBar.draw(graphicContext);
}
代码示例来源:origin: org.mapsforge/mapsforge-map-awt
@Override
public void paint(Graphics graphics) {
super.paint(graphics);
GraphicContext graphicContext = AwtGraphicFactory.createGraphicContext(graphics);
this.frameBuffer.draw(graphicContext);
if (this.mapScaleBar != null) {
this.mapScaleBar.draw(graphicContext);
}
this.fpsCounter.draw(graphicContext);
}
代码示例来源:origin: stackoverflow.com
BufferedImage image =
new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_RGB);
this.getContentPane().paint(image.getGraphics());
return image;
代码示例来源:origin: stackoverflow.com
Panel panel = new Panel(new BorderLayout()) {
public void update(java.awt.Graphics g) {
paint(g);
代码示例来源:origin: com.l2fprod.common/l2fprod-common-shared
void makeImage() {
// if we have no image or if the image has changed
if (getGraphicsConfiguration() != null && getWidth() > 0) {
Dimension dim = c.getPreferredSize();
// width and height must be > 0 to be able to create an image
if (dim.height > 0) {
img = getGraphicsConfiguration().createCompatibleImage(getWidth(),
dim.height);
c.setSize(getWidth(), dim.height);
c.paint(img.getGraphics());
} else {
img = null;
}
}
}
代码示例来源:origin: com.jtattoo/JTattoo
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
BufferedImage bi = gc.createCompatibleImage(savedContentPane.getWidth(), savedContentPane.getHeight());
savedContentPane.paint(bi.getGraphics());
resizingPanel = new ResizingPanel(bi);
getRootPane().setContentPane(resizingPanel);
代码示例来源:origin: stackoverflow.com
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
at java.awt.Container.paint(Container.java:1778)
at java.awt.Window.paint(Window.java:3379)
内容来源于网络,如有侵权,请联系作者删除!