Results 1 to 7 of 7
  1. #1
    b_erten is offline Member
    Join Date
    Dec 2009
    Posts
    8
    Rep Power
    0

    Default drawing a parallelogram and filling inside with a colour

    Hello,

    I drew a parallelogram shape with using four "drawLine()" however I don't how to fill its inside with a colour.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,685
    Rep Power
    8

    Default

    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)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    b_erten is offline Member
    Join Date
    Dec 2009
    Posts
    8
    Rep Power
    0

    Default

    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:

  4. #4
    b_erten is offline Member
    Join Date
    Dec 2009
    Posts
    8
    Rep Power
    0

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,685
    Rep Power
    8

    Default

    Quote Originally Posted by b_erten View Post
    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:
    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)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    b_erten is offline Member
    Join Date
    Dec 2009
    Posts
    8
    Rep Power
    0

    Default

    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.

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,685
    Rep Power
    8

    Default

    Quote Originally Posted by b_erten View Post
    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.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Filling a JTable
    By aborgeld in forum Advanced Java
    Replies: 0
    Last Post: 01-08-2011, 01:37 PM
  2. Filling Arrays??
    By Bgreen7887 in forum New To Java
    Replies: 8
    Last Post: 11-04-2010, 06:51 AM
  3. Replies: 2
    Last Post: 04-10-2010, 06:35 PM
  4. I have a problem filling out this method
    By kira137 in forum New To Java
    Replies: 6
    Last Post: 10-11-2009, 01:43 AM
  5. Filling 2D Array
    By Nakira in forum New To Java
    Replies: 3
    Last Post: 11-12-2008, 12:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •