+1 (315) 557-6473 

Creating a House Project Help Involving Java.

The following Creating a House Project Help demonstrates how to write a program for creating a house with specified shapes in Java. Our Java Homework Help programmer wrote an accurate program that meets all the underlying house's requirements.

creating a house project help
Parts Of the House
1. 1 arc
2. 2 different polygons (must be at least 3-sided or more than 4 sided)
3. 1 PolyLine with a minimum of 4 coordinate pairs
4. 1 rounded rectangle
5. 1 QuadCurve 2D
Creating a House Project Help Involving Java
6. 1 CubicCurve 2D 
Creating a House Project Help Involving Java
Using Absolute coding techniques with the swing API.
7. 6 (at least) other shapes of your choice
You must use absolute coding techniques with the swing API. Your picture must be centered on any screen and shouldn't exceed 1440 by 800 (size). The size of the JFrame should not be changeable by the user. The JFrame must be titled. The Java program mist close when the JFrame is closed.
import javax.swing.*;
import java.awt.*;
import java.awt.geom.CubicCurve2D;
import java.awt.geom.QuadCurve2D;
public class CanvasFrame extends JFrame {
    public CanvasFrame() {
        setTitle("My canvas");
        getContentPane().add(new Canvas());
        setPreferredSize(new Dimension( 800, 600));
    private static class Canvas extends JPanel {
        public void paint(Graphics g) {
            // drawing background
            g.fillRect(0, 0, getWidth(), getHeight());
            // drawing field
            g.fillArc(-getWidth()/2, 400, 2*getWidth(), 400, 0, 180);
            // drawing house
            int[] housePointsX = new int[]{250, 250, 550, 550};
            int[] housePointsY = new int[]{500, 200, 200, 500};
            g.fillPolygon(new Polygon(housePointsX, housePointsY, 4));
            // drawing roof
            int[] roofPointsX = new int[]{220, 400, 580};
            int[] roofPointsY = new int[]{220, 100, 220};
            g.setColor(new Color(128, 64, 0, 255));
            g.fillPolygon(new Polygon(roofPointsX, roofPointsY, 3));
            // drawing door
            g.fillRect(450, 290, 80, 200);
            // drawing door sections
            int[] doorSectionsX = new int[]{460, 460, 520, 520, 460, 460, 520, 520};
            int[] doorSectionsY = new int[]{400, 300, 300, 400, 400, 480, 480 ,400};
            g.drawPolyline(doorSectionsX, doorSectionsY, 8);
            // drawing window
            g.fillRoundRect(280, 290, 100, 100, 20, 20);
// g.setColor(Color.RED);
// QuadCurve2D quad = new QuadCurve2D.Double(100, 100, 100, 400, 200, 100);
// ((Graphics2D) g).draw(quad);
            // drawing chimney
            g.fillRect(280, 120, 30, 80);
            // drawing smoke
            QuadCurve2D quad1 = new QuadCurve2D.Double(285, 115, 275, 55, 270, 70);
            ((Graphics2D) g).draw(quad1);
            QuadCurve2D quad2 = new QuadCurve2D.Double(305, 115, 315, 55, 320, 70);
            ((Graphics2D) g).draw(quad2);
            CubicCurve2D cubic = new CubicCurve2D.Double(295, 115, 285, 100, 305, 85, 295, 70);
            ((Graphics2D) g).draw(cubic);
    public static void main(String[] args) {
Related Blogs

Java tutors in the USAJava is a computing language designed for the development of desktop and mobile applications, embedded systems, and the processing of big data. Introduced in 1995, Java is so much like C and C + + but easier to use because it enforces the object-oriented programming model. One ...

Read More

Are You Troubled with Your Java Programming Homework?Java programming language was derived from C but is more flexible and compatible with multiple platforms. Java’s true power lies within people’s ability to manipulate the objects and variables within a program, which is why it is considered an obj...

Read More

Why You May Seriously Need Help With Java Programming Homework?How well are you conversant with Java programming? Given Java homework, can you handle it correctly for impressive results? Well, if you can not, there is a need to seek help with the Java programming homework. Also, even after get...

Read More

Why C# Programming Homework Help Is Better Than JavaThere are a lot of similarities between Java and C#, and the responsibility of this can be placed on Sun. Microsoft used to have its own implementation of Java which had some changes so that you could access Windows fully but Sun sued and so Micros...

Read More

Improving Your Java Coding Skills by Learning How to DebugIt is no secret that most students spend a lot of time debugging rather than writing their Java code. In most universities and colleges, professors will only teach you the concepts of coding in Java and not how to fix the defects in your soft...

Read More