Package java.awt

Examples of java.awt.Graphics.dispose()


      sRand += tmp;
      // 将系统随机字符添加到图形验证码图片上
      g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
      g.drawString(tmp, FONT_SIZE * i + 5, FONT_SIZE + 5);
    }
    g.dispose();
    try {
      ImageIO.write(image, "JPEG", out);
      out.close();
    } catch (IOException e) {
      sRand = null;
View Full Code Here


            if (pg != null) {
                pg.translate(LEFT, HEIGHT);
                pg.drawRect(0, 0, pageSize.width - LEFT - 1, pageSize.height - HEIGHT - 1);
                view.print(new PrintCanvas(pg, view));
                pg.dispose();
            }

            job.end();
        }
        frame.dispose();
View Full Code Here

                    final String line = tk.nextToken();
                    graphic.drawString(line, x, y);
                    y += graphic.getFontMetrics().getHeight();
                }

                graphic.dispose();
            }

            job.end();
        }
        parent.dispose();
View Full Code Here

      // 调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成
      g.drawString(rand, 13 * i + 6, 16);
    }

    // 图象生效
    g.dispose();
   
    return sRand;
  }
 
  /*
 
View Full Code Here

      clipg.setColor(Color.white);
      Graphics2D g2d = (Graphics2D) clipg;
      g2d.setColor(Color.white);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      clipg.drawString(title, 0, gy);
      clipg.dispose();
    }

    int w = CONTROL_CLOSE.getWidth(c);
    gx = x + width - OUTER_PAD - w - 2;
    gy = y + OUTER_PAD + 2;
View Full Code Here

    Graphics2D g2d = (Graphics2D) clipg;
    g2d.setStroke(STROKE);
    g2d.setColor(GREEN_COLOR);
    JPopupMenuDesignOperation operation = (JPopupMenuDesignOperation) adaptable.getAdapter(IDesignOperation.class);
    g2d.drawLine(0, operation.getInsert_y(), jpm.getWidth(), operation.getInsert_y());
    clipg.dispose();
  }

  protected static Color GREEN_COLOR = new Color(164, 255, 0);
  protected static Stroke STROKE;
View Full Code Here

                }
                BufferedImage packedImage = new BufferedImage(image.getWidth(), image.getHeight(),
                        BufferedImage.TYPE_BYTE_BINARY);
                Graphics graphics = packedImage.getGraphics();
                graphics.drawImage(image, 0, 0, null);
                graphics.dispose();
                image = packedImage;
            }

            DataBuffer dBuf = image.getData().getDataBuffer();
            if (dBuf.getDataType() == DataBuffer.TYPE_BYTE)
View Full Code Here

        // avoid multiple of 8 to test padding
        assertFalse(bitonalImage.getWidth() % 8 == 0);
       
        g = bitonalImage.getGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();
        PDImageXObject ximage3 = LosslessFactory.createFromImage(document, bitonalImage);
        validate(ximage3, 1, bitonalImage.getWidth(), bitonalImage.getHeight(), "png", PDDeviceGray.INSTANCE.getName());
        checkIdent(bitonalImage, ximage3.getImage());

        // This part isn't really needed because this test doesn't break
View Full Code Here

        int w = image.getWidth();
        int h = image.getHeight();
        BufferedImage argbImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
        Graphics ag = argbImage.getGraphics();
        ag.drawImage(image, 0, 0, null);
        ag.dispose();

        for (int x = 0; x < argbImage.getWidth(); ++x)
        {
            for (int y = 0; y < argbImage.getHeight(); ++y)
            {
View Full Code Here

        int w = image.getWidth();
        int h = image.getHeight();
        BufferedImage argbImage = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR);
        Graphics ag = argbImage.getGraphics();
        ag.drawImage(image, 0, 0, null);
        ag.dispose();

        for (int x = 0; x < argbImage.getWidth(); ++x)
        {
            for (int y = 0; y < argbImage.getHeight(); ++y)
            {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.