Hi there. I noted that when i draw something with Color(0,0,0,0), which is over another image, the color shown is the JFrame background, not the image just below it.
Reasons that'd help me to find a solution?
Thanks!!
Edit: See the circles, the grey area (corners) should be transparent but are not, instead, they are the color of the JFrame.
And here is the code to draw the circles:
public void paint(final Graphics g) { super.paintComponent(g); final Graphics2D g2 = (Graphics2D) g; RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (unitImage == null) { unitImage = (BufferedImage) (createImage(30, 30)); final Graphics2D gc = unitImage.createGraphics(); gc.setRenderingHints(rh); gc.setColor(outsideColor); gc.fillOval(0, 0, diameter, diameter); gc.setColor(middleColor); gc.fillOval(diameter / 6, diameter / 6, (diameter / 3) * 2, (diameter / 3) * 2); gc.setColor(innerColor); gc.fillOval(diameter / 3, diameter / 3, diameter / 3, diameter / 3); } g2.drawImage(unitImage, null, 0, 0);
Been toying with the Alphacomposites, i think its not the solution. So i added all this new info which i believe, will help you guys to give me another tip.