
-----------------------------------
QuantumPhysics
Mon Oct 01, 2012 6:36 pm

Java Applet House Design
-----------------------------------
In our ICS4U class we had a stupid little project to design a 2D house using the java applet. I made this in about 45 minutes. Here is my house drawing:


import java.awt.*;
import java.applet.*;
 
public class HouseDrawing extends Applet
{
    public void paint (Graphics g)
    {
        background(g);
        house (g);
        roof1 (g);
        roof2 (g);
        windows (g);
        framing (g);
        extras (g);
        text (g);
    }
     
    public void background(Graphics g) 
    {
        setBackground (new Color(65,105,225));
        g.setColor (new Color (225,225,225)); 
        g.fillOval (15,35,170,55);
        g.fillOval (20,20,160,50);
        g.fillOval (350,50,170,55);
        g.fillOval (355,35,160,50);   
        g.setColor (new Color(225,140,0));  
        g.fillOval (650,035,120,120);
    }
     
    public void house (Graphics g)
    {
        g.setColor (new Color(139,69,19));   
        g.fillRect (100,250,400,200);
        g.fillRect (499,320,200,130);
        g.setColor(new Color(190,190,190));      
        g.fillRect (160,150,60,90);
        g.fillRect (245,380,110,70);
        g.fillRect (508,350,180,100);
        g.setColor (new Color(186,134,11));  
        g.fillOval (282,412,10,10);
        g.fillOval (307,412,10,10);
         
    }
     
    public void roof1 (Graphics g)
    {
        g.setColor(new Color(190,190,190));  
        int x

-----------------------------------
TokenHerbz
Mon Oct 01, 2012 10:11 pm

RE:Java Applet House Design
-----------------------------------
it is nice but you should set the window size so that people don't have to drag it bigger to see the expansion and the drive way...
