title: Draw 3D House using Java2D?
body: <p>How do I draw a simple 3D house using Java2D? I want to draw the side wall of the house to make it look like a simple 3D drawing.</p>
  
  <p>// House.java</p>
  
  <pre><code>import java.awt.Canvas;
  import java.awt.Color;
  import java.awt.Graphics;
  import java.awt.Graphics2D;
  import java.awt.GradientPaint;
  import java.awt.geom.Rectangle2D;
  
  public class House extends Canvas{
  
    House(){
      setSize(800,600);
    }
    public void paint(Graphics g){
  
      // house - foundation
      g.setColor(new Color(0xCDBE70));
      g.fillRect(148,500,304,50);
  
      // house - front
      g.setColor(new Color(0xFFEC8B));
      g.fillRect(150,350,300,150);
  
      // house - side 
      }    
    }
  </code></pre>
  
  <p>//ShowHouse.java</p>
  
  <pre><code>import java.awt.Frame; 
  import java.awt.AWTEvent;
  import java.awt.event.WindowEvent;
  
  public class ShowHouse extends Frame{ 
    public static void main(String arg[]){
      new ShowHouse(); 
    }
    ShowHouse(){ 
      enableEvents(AWTEvent.WINDOW_EVENT_MASK); 
      setLocation(250,50);
      House canvas = new House();
      add(canvas);
      pack(); 
      setVisible(true);
    }
    public void processWindowEvent(WindowEvent event){
      if(event.getID() == WindowEvent.WINDOW_CLOSING) 
        System.exit(0);
    }
    }
  </code></pre>