Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Java2D gradient bug. I have to finish this before I can collect my paycheck

 
Nicholas Turner
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this code
GradientPaint gp2 = new GradientPaint(0,0,Color.white,100,100,Color.black,false);
Rectangle2D r2 = new Rectangle(200,30,100, 100);
g2.setPaint(gp2);
g2.fill(r2);
if draw this its a square of white but if i change the false to true to acylic draw just fine. what gives i need a horizontal gradient from dark to light.
thanks,
nick
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Match up the paint coordinates to your rectangle coordinates...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic