• Post Reply Bookmark Topic Watch Topic
  • New Topic

GradientPaint  RSS feed

 
Sean Mac Eoin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, trying to compile this piece of code from book *Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization*.
The sucker refuses to compile, can anyone tell me why ?
Thanks in advance.
Compiler error below code.

-----------------------------------





----------------------------------------

 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you check the API of GradientPaint you will see that the parameter order is Point2D, Color, Point2D, Color, boolean. You're providing them as Point2D, Point2D, Color, Color, boolean. Swap the second and third arguments and the code should compile.

And please UseCodeTags next time.
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The order of the arguments is wrong.

java.awt.GradientPaint.GradientPaint(Point2D pt1, Color color1, Point2D pt2, Color color2, boolean cyclic)



This should work -



<edit> took too long to get my post in </edit>
 
Sean Mac Eoin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!