I have got a stupid problem.I want add a text with alpha 0.5 to my photo to make a watermark but setColor
doesn't add a color. When I trying use setComposite
I see the error "cannot find symbol".
buffered.getGraphics().drawImage(img, 0, 0, null);
buffered.getGraphics().setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
0.1f));
buffered.getGraphics().setColor(new Color(0.2f,0.3f,0.4f,0.5f));
buffered.getGraphics().setFont(new Font("Serif", Font.PLAIN, 32));
buffered.getGraphics().drawString("text", img.getWidth()/2, img.getHeight()/2);
buffered.getGraphics().dispose();