September 20, 201510 yr If anybody knows the command/method used to alter the transparency of a fillRect() for paint that would be great. I tried looking it up and saw that it might be called alpha to alter this, however I can't figure out how to change alpha. The only command i can see is getAlpha(). If anyone could provide me with an example that would be great. I'm sure I can figure it out from there! Thanks in advance!
September 20, 201510 yr Use a transparent color.Color has multiple constructors. The one that takes 4 int arguments is the one you want. The last argument is the "alpha": Color color = new Color(255, 0, 0, 100); void onPaint(Graphics2D g) { g.setColor(color); g.fillRect(...); } Edited September 20, 201510 yr by fixthissite
September 20, 201510 yr Use a transparent color. Color has multiple constructors. The one that takes 4 int arguments is the one you want. The last argument is the "alpha": Color color = new Color(255, 0, 0, 100); void onPaint(Graphics2D g) { g.setColor(color); g.fillRect(...); } This^ It is worth noting that, like the RGB values, the alpha constructor is also in the range 0-255 where 255 is solid colour. apa
September 22, 201510 yr Author Ahh just realized it was you again FixThisSite! I'll post a screen of proggy tomorrow morning
Create an account or sign in to comment