Reputation: 457
im interested i just finished writing a program and one of the functions that has been implemented is drawing a line with a triangle at the end (forming an arrow). How would i go about filling the inside of the triangle?
Upvotes: 0
Views: 613
Reputation: 12009
Take a look at the fillPolygon method of the Graphics
class. There's also a version that doesn't require you to make a Polygon, instead accepting arrays with the coordinates. If you've been drawing the lines separately until now instead of as a polygon, it shouldn't be too hard to switch to one of these methods. Just use the endpoint coordinates you've already got.
Upvotes: 2
Reputation: 1503080
In a paint method, call Graphics.fillPolygon
, or use Graphics2D.fill(Shape)
.
Upvotes: 1