Strange_Fk Posted September 20, 2015 Share Posted September 20, 2015 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! Quote Link to comment Share on other sites More sharing options...
fixthissite Posted September 20, 2015 Share Posted September 20, 2015 (edited) 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, 2015 by fixthissite 3 Quote Link to comment Share on other sites More sharing options...
Apaec Posted September 20, 2015 Share Posted September 20, 2015 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 2 Quote Link to comment Share on other sites More sharing options...
Strange_Fk Posted September 22, 2015 Author Share Posted September 22, 2015 hell yeah thanks guys much appreciated! 1 Quote Link to comment Share on other sites More sharing options...
Strange_Fk Posted September 22, 2015 Author Share Posted September 22, 2015 Ahh just realized it was you again FixThisSite! I'll post a screen of proggy tomorrow morning Quote Link to comment Share on other sites More sharing options...
Strange_Fk Posted September 22, 2015 Author Share Posted September 22, 2015 ayyy thanks guys Quote Link to comment Share on other sites More sharing options...