Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

davids dream house #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 169 additions & 48 deletions Picture/Picture.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,32 @@
* @author Michael Kölling and David J. Barnes
* @version 1.1 (24 May 2001)
*/



public class Picture
{
private Square wall;
private Square house;
private Square garage;
private Square garageDoor;
private Square door;
private Square frontDoor;
private Square window;
private Square window1;
private Square window2;
private Square grass;
private Triangle roof;
private Triangle garageRoof;
private Triangle tree;
private Triangle tree1;
private Circle sun;
private Circle doorKnob;
private Circle bush;
private Circle bush1;




/**
* Constructor for objects of class Picture
*/
Expand All @@ -30,57 +49,159 @@ public Picture()
*/
public void draw()
{
wall = new Square();
wall.moveVertical(80);
wall.changeSize(100);
wall.makeVisible();


window = new Square();
window.changeColor("black");
window.moveHorizontal(20);
window.moveVertical(100);
window.makeVisible();
house = new Square();
house.changeColor("blue");
house.moveVertical(50);
house.moveHorizontal(-5);
house.changeSize(130);
house.makeVisible();



garage = new Square();
garage.changeColor("blue");
garage.moveVertical(90);
garage.moveHorizontal(80);
garage.changeSize(120);
garage.makeVisible();


garageDoor = new Square();
garageDoor.changeColor("black");
garageDoor.moveVertical(100);
garageDoor.moveHorizontal(120);
garageDoor.changeSize(70);
garageDoor.makeVisible();



door = new Square();
door.changeColor("black");
door.moveVertical(140);
door.moveHorizontal(35);
door.makeVisible();

frontDoor = new Square();
frontDoor.changeColor("black");
frontDoor.moveVertical(130);
frontDoor.moveHorizontal(35);
frontDoor.makeVisible();



window = new Square();
window.changeColor("black");
window.moveVertical(60);
window.moveHorizontal(0);
window.makeVisible();



window1 = new Square();
window1.changeColor("black");
window1.moveVertical(60);
window1.moveHorizontal(40);
window1.makeVisible();



window2 = new Square();
window2.changeColor("black");
window2.moveVertical(60);
window2.moveHorizontal(90);
window2.makeVisible();



grass = new Square();
grass.changeColor("green");
grass.moveVertical(170);
grass.moveHorizontal(-60);
grass.changeSize(300);
grass.makeVisible();



roof = new Triangle();
roof.changeColor("red");
roof.moveVertical(5);
roof.moveHorizontal(70);
roof.changeSize(80,130);
roof.makeVisible();



garageRoof = new Triangle();
garageRoof.changeColor("red");
garageRoof.moveVertical(65);
garageRoof.moveHorizontal(170);
garageRoof.changeSize(60,80);
garageRoof.makeVisible();



tree = new Triangle();
tree.changeColor("green");
tree.moveVertical(80);
tree.moveHorizontal(-20);
tree.changeSize(130,30);
tree.makeVisible();



tree1 = new Triangle();
tree1.changeColor("green");
tree1.moveVertical(80);
tree1.moveHorizontal(230);
tree1.changeSize(130,30);
tree1.makeVisible();



sun = new Circle();
sun.changeColor("yellow");
sun.moveVertical(-60);
sun.moveHorizontal(-20);
sun.changeSize(80);
sun.makeVisible();




doorKnob = new Circle();
doorKnob.changeColor("magenta");
doorKnob.moveVertical(140);
doorKnob.moveHorizontal(98);
doorKnob.changeSize(5);
doorKnob.makeVisible();



bush = new Circle();
bush.changeColor("green");
bush.moveVertical(140);
bush.moveHorizontal(40);
bush.changeSize(30);
bush.makeVisible();


bush1 = new Circle();
bush1.changeColor("green");
bush1.moveVertical(140);
bush1.moveHorizontal(115);
bush1.changeSize(30);
bush1.makeVisible();




roof = new Triangle();
roof.changeSize(50, 140);
roof.moveHorizontal(60);
roof.moveVertical(70);
roof.makeVisible();

sun = new Circle();
sun.changeColor("yellow");
sun.moveHorizontal(180);
sun.moveVertical(-10);
sun.changeSize(60);
sun.makeVisible();

}

/**
* Change this picture to black/white display
*/
public void setBlackAndWhite()
{
if(wall != null) // only if it's painted already...
{
wall.changeColor("black");
window.changeColor("white");
roof.changeColor("black");
sun.changeColor("black");
}
}


/**
* Change this picture to use color display
*/
public void setColor()
{
if(wall != null) // only if it's painted already...
{
wall.changeColor("red");
window.changeColor("black");
roof.changeColor("green");
sun.changeColor("yellow");
}
}


}
48 changes: 24 additions & 24 deletions Picture/package.bluej
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@
dependency1.from=Circle
dependency1.to=Canvas
dependency1.type=UsesDependency
dependency2.from=Picture
dependency2.to=Square
dependency2.from=Triangle
dependency2.to=Canvas
dependency2.type=UsesDependency
dependency3.from=Picture
dependency3.to=Triangle
dependency3.from=Square
dependency3.to=Canvas
dependency3.type=UsesDependency
dependency4.from=Picture
dependency4.to=Circle
dependency4.from=PictureTest
dependency4.to=Picture
dependency4.type=UsesDependency
dependency5.from=Triangle
dependency5.to=Canvas
dependency5.from=Picture
dependency5.to=Square
dependency5.type=UsesDependency
dependency6.from=Square
dependency6.to=Canvas
dependency6.from=Picture
dependency6.to=Triangle
dependency6.type=UsesDependency
dependency7.from=PictureTest
dependency7.to=Picture
dependency7.from=Picture
dependency7.to=Circle
dependency7.type=UsesDependency
editor.fx.0.height=722
editor.fx.0.height=721
editor.fx.0.width=800
editor.fx.0.x=2086
editor.fx.0.y=284
objectbench.height=101
objectbench.width=461
editor.fx.0.x=240
editor.fx.0.y=23
objectbench.height=201
objectbench.width=776
package.divider.horizontal=0.6
package.divider.vertical=0.8007380073800738
package.editor.height=427
package.editor.width=674
package.editor.x=239
package.editor.y=118
package.frame.height=600
package.divider.vertical=0.5398230088495575
package.editor.height=237
package.editor.width=666
package.editor.x=9
package.editor.y=46
package.frame.height=510
package.frame.width=800
package.numDependencies=7
package.numTargets=6
Expand All @@ -49,7 +49,7 @@ target1.name=Circle
target1.showInterface=false
target1.type=ClassTarget
target1.width=80
target1.x=110
target1.x=100
target1.y=120
target2.association=PictureTest
target2.height=40
Expand Down
18 changes: 9 additions & 9 deletions Shapes/package.bluej
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ editor.fx.0.height=0
editor.fx.0.width=0
editor.fx.0.x=0
editor.fx.0.y=0
objectbench.height=160
objectbench.width=769
objectbench.height=191
objectbench.width=892
package.divider.horizontal=0.5996908809891809
package.divider.vertical=0.7822685788787483
package.editor.height=593
package.editor.width=1188
package.editor.x=246
package.editor.y=192
package.frame.height=825
package.frame.width=1314
package.divider.vertical=0.7009063444108762
package.editor.height=457
package.editor.width=814
package.editor.x=348
package.editor.y=23
package.frame.height=720
package.frame.width=932
package.numDependencies=3
package.numTargets=4
package.showExtends=true
Expand Down
Loading