Hello,
I drew a parallelogram shape with using four "drawLine()" however I don't how to fill its inside with a colour.
Printable View
Hello,
I drew a parallelogram shape with using four "drawLine()" however I don't how to fill its inside with a colour.
The easiest way to do it is probably to create a Polygon with the points you use to create the lines, then just use that to draw or fill instead of the lines.
Google is your friend, but here's a good start: Polygon (Java Platform SE 6)
Oh thank you this would be useful. I also need a parallelogram in which two sides are straight line the other sides needs to be curved (like an arc)? Can I also draw this shape with using Polygon methods?
like this:
http://img268.imageshack.us/i/testpattern.jpg/
Most people won't click external links like that. But you might want to give this tutorial a read-through: Lesson: Advanced Topics in Java2D (The Java™ Tutorials > 2D Graphics)
I tried to link an image to show my figure but I couldn't upload an image it asked me an "url" address that's why I included an external link. Thank you for the tutorial.
It's not a big deal, it's just that some people will hesitate for fear of viruses, or others (like myself) might have sites like that blocked by school or work networks. ASCII art is sometimes best, heh.
I hope that tutorial helps. Let us know if you still have questions- and feel free to post an SSCCE that shows us where you get stuck.