Example #1
0
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D gd = (Graphics2D) g.create();
    gd.setColor(new Color(220, 220, 240));
    gd.fillRect(0, 0, getWidth(), getHeight());

    // draw logo
    int width = getWidth();
    int height = getHeight();
    int stepX = 100;
    int stepY = 100;
    boolean flag1 = false, flag2;
    for (int y = 0; y <= height; y += stepY) {
      flag1 = !flag1;
      flag2 = flag1;
      for (int x = 0; x <= width; x += stepX) {
        if (flag2) {
          gd.drawImage(logoAveros, x, y, null);
        }
        flag2 = !flag2;
      }
    }
    gd.dispose();
  }
  public void paintComponent(Graphics g) {

    if (backImage == null) {
      super.paintComponent(g);
    } else {
      g.drawImage(
          backImage,
          (this.getSize().width - backImage.getWidth(null)),
          (this.getSize().height - backImage.getHeight(null)),
          this);
    }
  }
Example #3
0
  @Override
  public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    super.paintComponent(g);

    if (gradientImage == null || gradientImage.getHeight() != getHeight()) {
      myPaint.setBounds(this.getBounds());
      Paint p = myPaint.getPaint();
      gradientImage = new BufferedImage(1, getHeight(), BufferedImage.TYPE_INT_RGB);
      Graphics2D gg = (Graphics2D) gradientImage.getGraphics();
      gg.setPaint(p);
      gg.fillRect(0, 0, 1, getHeight());
      gg.dispose();
    }

    g2.drawImage(gradientImage, 0, 0, getWidth(), getHeight(), null);
    //		if (bg != null) {
    //			g2.drawImage(bg, 0, 0, bg.getWidth(), bg.getHeight(), null);
    //		}

  }
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g); // To change body of generated methods, choose Tools | Templates.
   g.drawImage(img, 0, 0, getWidth(), getHeight(), this);
 }