Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes Help with Java2D gradient bug. I have to finish this before I can collect my paycheck Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help with Java2D gradient bug. I have to finish this before I can collect my paycheck" Watch "Help with Java2D gradient bug. I have to finish this before I can collect my paycheck" New topic
Author

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

Nicholas Turner
Ranch Hand

Joined: May 24, 2003
Posts: 126
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

Joined: Oct 18, 2000
Posts: 4121

Match up the paint coordinates to your rectangle coordinates...



-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with Java2D gradient bug. I have to finish this before I can collect my paycheck
 
Similar Threads
Frame
Debugging
compile errors
jfreechart bar chart - show item value
custom repaint on JButton on mouserollover