Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Default Java Basics: How to draw a house?

    I need codes for a simple house (using rectangles, lines and other basic shapes)

    It has to be on the ground (bottom)

    house with a roof, door and windows

    Thanks for any help! :)

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default Re: Java Basics: How to draw a house?

    Take a piece of grid paper and draw the house. Then figure out the coordinates of the end points of all the lines.
    Given those points you should be able to call the drawLine() method to draw the house.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,536
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java Basics: How to draw a house?

    The Graphics.fillRect( ... ) method can draw an appartment building; no doors and no windows though ... it's more like a prison building, no matter what Color you're using.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,247
    Rep Power
    19

    Default Re: Java Basics: How to draw a house?

    I've never seen a shocking pink prison building ...
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,536
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java Basics: How to draw a house?

    Quote Originally Posted by DarrylBurke View Post
    I've never seen a shocking pink prison building ...
    Really? In Rotterdam there's a light blue and orange prison; but here's another secret: the Graphics.fillOval( ... ) method can draw well fed politicians. No brains though but that's for a more natural look ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,247
    Rep Power
    19

    Default Re: Java Basics: How to draw a house?

    Light blue and orange ain't neither shocking nor pink ;)

    You could use Graphics.drawOval(...) for the politicians' heads
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,536
    Blog Entries
    7
    Rep Power
    20

    Default Re: Java Basics: How to draw a house?

    Quote Originally Posted by DarrylBurke View Post
    Light blue and orange ain't neither shocking nor pink ;)
    No, sorry, there are no pink prisons overhere (that I know of).

    Quote Originally Posted by DarrylBurke View Post
    You could use Graphics.drawOval(...) for the politicians' heads
    No, that'd be cheating; you can use Graphics.fillRect( ... ) again with width == height for a perfect blockhead ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. java basics
    By rachushetty in forum New To Java
    Replies: 6
    Last Post: 11-13-2012, 12:43 PM
  2. Replies: 6
    Last Post: 08-18-2012, 09:54 AM
  3. Replies: 1
    Last Post: 06-29-2012, 12:32 AM
  4. basics of java
    By kmd prasadNaidu in forum New To Java
    Replies: 5
    Last Post: 12-27-2011, 03:42 PM
  5. Anyone willing to help me with Java basics?
    By Rocketz in forum New To Java
    Replies: 7
    Last Post: 02-23-2011, 04:30 AM

Posting Permissions

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