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

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

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

JPanel.paint介绍

暂无

代码示例

代码示例来源:origin: MovingBlocks/Terasology

@Override
public void paint(Graphics g) {
  if (!image.render(g, 0, 0)) {
    super.paint(g);
  }
}

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

public BufferedImage createImage(JPanel panel) {

  int w = panel.getWidth();
  int h = panel.getHeight();
  BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
  Graphics2D g = bi.createGraphics();
  panel.paint(g);
  return bi;
}

代码示例来源:origin: runelite/runelite

@Override
public void paint(Graphics g)
{
  super.paint(g);
  g.setColor(TRACK_COLOR);
  g.fillRect(0, this.getHeight() / 2 - 2, this.getWidth() - KNOB_WIDTH, 5);
  g.setColor(KNOB_COLOR);
  g.fillRect(value - KNOB_WIDTH / 2, this.getHeight() / 2 - KNOB_HEIGHT / 2, KNOB_WIDTH, KNOB_HEIGHT);
}

代码示例来源:origin: runelite/runelite

@Override
  public void paint(Graphics g)
  {
    super.paint(g);

    for (int x = 0; x < getWidth(); x += CHECKER_SIZE)
    {
      for (int y = 0; y < getHeight(); y += CHECKER_SIZE)
      {
        int val = (x / CHECKER_SIZE + y / CHECKER_SIZE) % 2;
        g.setColor(val == 0 ? Color.LIGHT_GRAY : Color.WHITE);
        g.fillRect(x, y, CHECKER_SIZE, CHECKER_SIZE);
      }
    }

    g.setColor(color);
    g.fillRect(0, 0, this.getWidth(), this.getHeight());
  }
}

代码示例来源:origin: apache/geode

@Override
 public void paint(Graphics g) {
  super.paint(g);

  if (zoomBoxStartX != -1 && zoomBoxStartY != -1 && zoomBoxWidth != -1 && zoomBoxHeight != -1) {
   Graphics2D g2 = (Graphics2D) g.create();

   Composite old = g2.getComposite();
   g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
   g2.setColor(Color.BLUE);

   // g2.drawRect(zoomBoxStartX, zoomBoxStartY, zoomBoxWidth, zoomBoxHeight);
   // g2.setBackground(Color.BLUE);
   g2.fillRect(getBoxX(), getBoxY(), getBoxWidth(), getBoxHeight());
   g2.setComposite(old);
  }
 }
}

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

JScrollPane scroll = new JScrollPane(table);
 JPanel p = new JPanel(new BorderLayout());
 p.add(scroll, BorderLayout.CENTER);
 JOptionPane.showMessageDialog(null, p);
 table.addNotify();
 p.doLayout();
 BufferedImage bi = new BufferedImage(p.getWidth() + 100,
     p.getHeight() + 100, BufferedImage.TYPE_INT_RGB);
 Graphics g = bi.createGraphics();
 p.paint(g);
 g.dispose();

代码示例来源:origin: geotools/geotools

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.black);
    g2d.setTransform(
        AffineTransform.getTranslateInstance(
            -shp.getBounds().getMinX(), -shp.getBounds().getMinY()));
    g2d.draw(shp);
    g2d.dispose();
  }
}

代码示例来源:origin: SKCraft/Launcher

@Override
  public void paint(Graphics g) {
    super.paint(g);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

@Override
public void paint(Graphics g) {
  super.paint(g);
  if (CHANGE_BUTTON) {
    shiftRect = shift.getBounds();
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

public void paint(Graphics g) {
 //JMH I am only overriding this to get a picture of the time taken to paint
 long start = System.currentTimeMillis();
 super.paint(g);
 long elapsed = System.currentTimeMillis()-start;
 System.out.println("Paint time = "+elapsed);
}

代码示例来源:origin: jrtom/jung

@Override
 public void paint(Graphics g) {
  super.paint(g);
  Graphics2D g2d = (Graphics2D) g;
  Collection<Shape> grid = rTree.getGrid();
  log.info("grid size is {}", grid.size());
  for (Shape r : grid) {
   g2d.draw(r);
  }
 }
};

代码示例来源:origin: org.jppf/jppf-common-node

@Override
public void paint(final Graphics g) {
 super.paint(g);
 paintLogos(g);
}

代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-swing

/***************************************************************************
 *
 *
 **************************************************************************/
@Override
public void paint (final Graphics g)
 {
  super.paint(g);
  logger.fine("paint() - " + getBounds());
 }

代码示例来源:origin: omegat-org/omegat

@Override
public void paint(Graphics g) {
  super.paint(g);
  if (comp != null) {
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setStroke(STROKE_OBJ);
    paintHighlight(g2);
    g2.dispose();
  }
}

代码示例来源:origin: JetBrains/jediterm

private void doPaint(final Graphics g) {
  doTranslate((x, y) -> g.translate(x, y));
  final Composite oldComposite = ((Graphics2D) g).getComposite();
  //if (myTabs instanceof JBEditorTabs && !myTabs.isSingleRow() && myTabs.getSelectedInfo() != myInfo) {
  //  ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f));
  //}
  super.paint(g);
  ((Graphics2D) g).setComposite(oldComposite);
  doTranslate((x2, y2) -> g.translate(-x2, -y2));
}

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

void TakeSnapShot(JPanel panel,String Locatefile){  
     BufferedImage bi = new BufferedImage(panel.getSize().width,  panel.getSize().height,BufferedImage.TYPE_INT_RGB);  
     panel.paint(bi.createGraphics()); 
     File image = new File(Locatefile);  
   try{  
     image.createNewFile();  
     ImageIO.write(bi, "png", image);
   }catch(Exception ex){  
   }  
 }

代码示例来源:origin: jsettlers/settlers-remake

@Override
public void paint(Graphics g) {
  super.paint(g);
  BackgroundPanelUi ui = (BackgroundPanelUi) getUI();
  ui.paintForeground(g, this);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-midp

@Override
  public void paint(Graphics g) {
    super.paint(g);
    gauge.setPanel(this);
    gauge.paintGauge(g);
  }
};

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

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

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

@Override
public void paint(Graphics g) {
  super.paint(g);
  paintResizableMark(g);
  paintTimeMarks(g);
}

相关文章

微信公众号

最新文章

更多

JPanel类方法