javax.swing.JPanel.paintAll()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中javax.swing.JPanel.paintAll()方法的一些代码示例,展示了JPanel.paintAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.paintAll()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:paintAll

JPanel.paintAll介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JPanel dPanel;
...     
public void save()
{
  BufferedImage bImg = new BufferedImage(dPanel.getWidth(), dPanel.getHeight(), BufferedImage.TYPE_INT_RGB);
  Graphics2D cg = bImg.createGraphics();
  dPanel.paintAll(cg);
  try {
      if (ImageIO.write(bImg, "png", new File("./output_image.png")))
      {
        System.out.println("-- saved");
      }
  } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
}

代码示例来源:origin: stackoverflow.com

JButton button = createButton();
 JPanel panel = createPanel();
 public TestContentPane() {
   paintButtonCheck = createRadioButton("paint button", true);
   paintPanelCheck = createRadioButton("paint panel", false);
   ButtonGroup buttonGroup = new ButtonGroup();
   buttonGroup.add(paintButtonCheck);
   buttonGroup.add(paintPanelCheck);
   add(paintButtonCheck);
   add(paintPanelCheck);
   //Hack, just prove something (realize both components)
   add(panel);
   add(button);
 }
 ...
 @Override
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   g.translate(100, 100);
   if (paintButtonCheck.isSelected()) {
     button.paintAll(g);
   } else {
     panel.paintAll(g);
   }
   g.translate(-100, -100);
 }

代码示例来源:origin: com.jidesoft/jide-oss

@Override
public void paintAll(Graphics g) {
  if ((getInvokeCondition() & INVOKE_ON_PAINT) != 0) {
    initialize();
  }
  super.paintAll(g);
}

代码示例来源:origin: stackoverflow.com

panel.paintAll ( g2d );
g2d.dispose ();

代码示例来源:origin: stackoverflow.com

public static BufferedImage componentToImageWithSwing(Component component, Rectangle region) {
  BufferedImage img = new BufferedImage(component.getWidth(), component.getHeight(), BufferedImage.TYPE_INT_RGB);
  Graphics g = img.createGraphics();

  // Real render
  if (component.getPreferredSize().height == 0 && component.getPreferredSize().width == 0)
  {
    component.setPreferredSize(component.getSize());
  }

  JDialog f = new JDialog();
  JPanel p = new JPanel();
  p.add(component);
  f.add(p);
  f.pack();
  f.setLocation(-f.getWidth() - 10, -f.getHeight() -10);
  f.setVisible(true);
  p.paintAll(g);
  f.dispose();
  // ---

  g.dispose();
  if (region == null) {
    return img;
  }
  return img.getSubimage(region.x, region.y, region.width, region.height);
}

代码示例来源:origin: com.github.jjYBdx4IL/github-test-utils

protected void saveWindowAsImage(String filename) {
  screenshotCounter++;
  BufferedImage img = new BufferedImage(getContainer().getWidth(), getContainer().getHeight(), BufferedImage.TYPE_INT_ARGB);
  getContainer().paintAll(img.getGraphics());
  File f = new File(FileUtil.getMavenTargetDir(),
      "screenshots" + File.separator + getClass().getName() + "_" + screenshotCounter + (filename != null ? "_" + filename : "") + ".png");
  File parent = f.getParentFile();
  if (!parent.exists()) {
    assertTrue(parent.mkdirs());
  }
  log.info("saving window contents to " + f.getPath());
  try {
    assertTrue(ImageIO.write(img, "png", f));
  } catch (IOException ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: com.github.jjYBdx4IL.utils/junit4-utils

protected void saveWindowAsImage(String filename) {
  screenshotCounter++;
  BufferedImage img = new BufferedImage(getContainer().getWidth(), getContainer().getHeight(), BufferedImage.TYPE_INT_ARGB);
  getContainer().paintAll(img.getGraphics());
  File f = new File(Maven.getMavenTargetDir(),
      "screenshots" + File.separator + getClass().getName() + "_" + screenshotCounter + (filename != null ? "_" + filename : "") + ".png");
  File parent = f.getParentFile();
  if (!parent.exists()) {
    assertTrue(parent.mkdirs());
  }
  log.info("saving window contents to " + f.getPath());
  try {
    assertTrue(ImageIO.write(img, "png", f));
  } catch (IOException ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: org.rescarta.rc-cmgr/rc-cmgr

this.selectedCollectionJPanel.add(this.rcCollectionJPanel);
this.selectedCollectionJPanel.paintAll(selectedCollectionJPanel.getGraphics());
this.hideWaitCursor();

代码示例来源:origin: org.rescarta.rc-cmgr/rc-cmgr

this.rcObjMdJPanel.getMetadataContentJScrollPane().getVerticalScrollBar().setValue(yScrollPos);
this.selectedObjectMetadataJPanel.paintAll(selectedObjectMetadataJPanel.getGraphics());

代码示例来源:origin: org.rescarta.rc-cmgr/rc-cmgr

this.rcObjMdJPanel.getMetadataContentJScrollPane().getVerticalScrollBar().setValue(yScrollPos);
this.selectedObjectJPanel.paintAll(selectedObjectJPanel.getGraphics());

相关文章

JPanel类方法