Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public void drawIt(Graphics graphics)
  2. {
  3. Dimension size = label.getPreferredSize();
  4. BufferedImage image = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
  5.  
  6. Graphics imageGraphics = image.createGraphics();
  7. label.paint(imageGraphics);
  8. graphics.drawImage(image, 100, 100, null);
  9.  
  10. imageGraphics.dispose();
  11. }
  12.  
  13. label.paint(graphics);
  14.  
  15. label.paint(graphics);
  16.  
  17. graphics.translate(100, 100);
  18. label.paint(graphics);
  19. graphics.translate(-100, -100); //set origin back to 0, 0 for following calls
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement