I've allready shown

java-logo-ruby-style

in java it's really simple. A few lines of code are better than a lot of words….

  • get the image contained into the jLabel
        Image myImage     = iconToImage(jLabel1.getIcon());
        BufferedImage img = (BufferedImage)myImage;
  • create the graphic2d
        Graphics2D g2d    = img.createGraphics();
        g2d.drawImage(img, 0, 0, null);
  • setup the color for the string​
        g2d.setPaint(textColor);
  • setup the font​
        g2d.setFont(new Font("Serif", Font.BOLD, fontsize));

 

  • draw the string into the g2d
       g2d.drawString(s1, xCoordinate,yCoordinate);

 

That's all!

Gg1