Guest User

Untitled

a guest
Apr 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.  public Picture makeInfoPhoto()
  2.   {
  3.     String fileName = this.getFile();
  4.     String text = this.toString();
  5.     // read in first picture
  6.     Picture pic1 = new Picture(fileName);
  7.     // create second picture with same height as 1st pic
  8.     Picture pic2 = new Picture(500,pic1.getHeight());
  9.     // copy pic1 over to new one
  10.     pic2.copyPictureTo(pic1,0,0);
  11.     // work around for failing drawString method
  12.     Graphics g = pic2.getGraphics();
  13.     g.setColor(Color.BLACK);
  14.     g.setFont(new Font("Arial", Font.BOLD, 16));
  15.     // draw userinfo on photo
  16.     g.drawString(text, 250, 50);
  17.     // return photo
  18.     return pic2;
  19.   }
Add Comment
Please, Sign In to add comment