From 52eca5a709189f205ab38322c7476911917e3d5d Mon Sep 17 00:00:00 2001 From: Fenniless Date: Mon, 4 Feb 2019 22:10:15 -0500 Subject: [PATCH] house we made day1 --- Picture/Picture.java | 71 +++++++++++++++++++++++++++++-------------- Picture/Square.java | 2 +- Picture/package.bluej | 37 +++++++++++----------- README.md | 6 ++-- Shapes/Circle.java | 3 +- Shapes/package.bluej | 32 +++++++++---------- 6 files changed, 87 insertions(+), 64 deletions(-) diff --git a/Picture/Picture.java b/Picture/Picture.java index c5c557a..55f83b7 100644 --- a/Picture/Picture.java +++ b/Picture/Picture.java @@ -12,10 +12,13 @@ */ public class Picture { - private Square wall; + private Square house; private Square window; private Triangle roof; - private Circle sun; + private Square ground; + private Triangle tree; + private Triangle tree1; + private Triangle tree2; /** * Constructor for objects of class Picture @@ -30,29 +33,51 @@ public Picture() */ public void draw() { - wall = new Square(); - wall.moveVertical(80); - wall.changeSize(100); - wall.makeVisible(); + house = new Square(); + house.moveHorizontal(20); + house.changeSize(200); + house.makeVisible(); + house.changeColor("red"); window = new Square(); - window.changeColor("black"); - window.moveHorizontal(20); + window.changeColor("white"); + window.moveHorizontal(50); window.moveVertical(100); window.makeVisible(); + window.changeSize(30); + roof = new Triangle(); - roof.changeSize(50, 140); - roof.moveHorizontal(60); - roof.moveVertical(70); + roof.changeSize(20, 200); + roof.moveHorizontal(135); + roof.moveVertical(15); roof.makeVisible(); + roof.changeColor("yellow"); - sun = new Circle(); - sun.changeColor("yellow"); - sun.moveHorizontal(180); - sun.moveVertical(-10); - sun.changeSize(60); - sun.makeVisible(); + ground = new Square(); + ground.changeColor("green"); + ground.moveHorizontal(-200); + ground.moveVertical(200); + ground.changeSize(1000); + ground.makeVisible(); + + tree = new Triangle(); + tree.changeColor("blue"); + tree.changeSize(150,50); + tree.moveVertical(100); + tree.makeVisible(); + + tree2 = new Triangle(); + tree2.changeColor("blue"); + tree2.changeSize(150,50); + tree2.moveVertical(50); + tree2.makeVisible(); + + tree1 = new Triangle(); + tree1.changeColor("blue"); + tree1.changeSize(150,50); + tree1.moveVertical(0); + tree1.makeVisible(); } /** @@ -60,12 +85,12 @@ public void draw() */ public void setBlackAndWhite() { - if(wall != null) // only if it's painted already... + if(house != null) // only if it's painted already... { - wall.changeColor("black"); + house.changeColor("black"); window.changeColor("white"); roof.changeColor("black"); - sun.changeColor("black"); + tree.changeColor("black"); } } @@ -74,12 +99,12 @@ public void setBlackAndWhite() */ public void setColor() { - if(wall != null) // only if it's painted already... + if(house != null) // only if it's painted already... { - wall.changeColor("red"); + house.changeColor("red"); window.changeColor("black"); roof.changeColor("green"); - sun.changeColor("yellow"); + tree.changeColor("yellow"); } } diff --git a/Picture/Square.java b/Picture/Square.java index 86fec28..011cb27 100644 --- a/Picture/Square.java +++ b/Picture/Square.java @@ -23,7 +23,7 @@ public Square() size = 30; xPosition = 60; yPosition = 50; - color = "red"; + color = "white"; isVisible = false; } diff --git a/Picture/package.bluej b/Picture/package.bluej index cc8c368..ce5eb88 100644 --- a/Picture/package.bluej +++ b/Picture/package.bluej @@ -1,37 +1,34 @@ #BlueJ package file -dependency1.from=Circle +dependency1.from=Triangle dependency1.to=Canvas dependency1.type=UsesDependency -dependency2.from=Picture -dependency2.to=Square +dependency2.from=Square +dependency2.to=Canvas dependency2.type=UsesDependency -dependency3.from=Picture -dependency3.to=Triangle +dependency3.from=Circle +dependency3.to=Canvas dependency3.type=UsesDependency dependency4.from=Picture -dependency4.to=Circle +dependency4.to=Square dependency4.type=UsesDependency -dependency5.from=Triangle -dependency5.to=Canvas +dependency5.from=Picture +dependency5.to=Triangle dependency5.type=UsesDependency -dependency6.from=Square -dependency6.to=Canvas -dependency6.type=UsesDependency -editor.fx.0.height=722 +editor.fx.0.height=709 editor.fx.0.width=800 -editor.fx.0.x=2086 -editor.fx.0.y=284 +editor.fx.0.x=480 +editor.fx.0.y=23 objectbench.height=101 -objectbench.width=461 +objectbench.width=776 package.divider.horizontal=0.6 package.divider.vertical=0.8007380073800738 package.editor.height=427 package.editor.width=674 -package.editor.x=2011 -package.editor.y=179 +package.editor.x=337 +package.editor.y=25 package.frame.height=600 package.frame.width=800 -package.numDependencies=6 +package.numDependencies=5 package.numTargets=5 package.showExtends=true package.showUses=true @@ -53,8 +50,8 @@ target2.name=Picture target2.showInterface=false target2.type=ClassTarget target2.width=80 -target2.x=420 -target2.y=160 +target2.x=440 +target2.y=260 target3.height=40 target3.name=Canvas target3.showInterface=false diff --git a/README.md b/README.md index 7fe8125..c2e76f1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# BlueJ-DreamHouseDrawing +# FirstLab-Shapes This is the first BlueJ lab. @@ -18,6 +18,6 @@ Be sure to Object of lab is to follow the chapter reading the Chapter 1 pdf in the doc folder. (and Draw a House!) -Can you draw a house with a tree along side? (think `trunk` and `circle` or a tall, skinny `triangle`.) +# Can you draw a house with a tree along side? (think `trunk` and `circle` or a tall, skinny `triangle`.) -When finished, post a screen shot of your house to the slack chatter channel. +# When finished, post a screen shot of your house to the slack chatter channel. diff --git a/Shapes/Circle.java b/Shapes/Circle.java index 3e74bec..4122806 100644 --- a/Shapes/Circle.java +++ b/Shapes/Circle.java @@ -33,7 +33,8 @@ public Circle() */ public void makeVisible() { - isVisible = true; + isVisible = false + ; draw(); } diff --git a/Shapes/package.bluej b/Shapes/package.bluej index 5e6c247..3320aa7 100644 --- a/Shapes/package.bluej +++ b/Shapes/package.bluej @@ -1,27 +1,27 @@ #BlueJ package file -dependency1.from=Circle +dependency1.from=Triangle dependency1.to=Canvas dependency1.type=UsesDependency -dependency2.from=Triangle +dependency2.from=Square dependency2.to=Canvas dependency2.type=UsesDependency -dependency3.from=Square +dependency3.from=Circle dependency3.to=Canvas dependency3.type=UsesDependency -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 +editor.fx.0.height=709 +editor.fx.0.width=800 +editor.fx.0.x=545 +editor.fx.0.y=23 +objectbench.height=135 +objectbench.width=994 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.7818740399385561 +package.editor.height=502 +package.editor.width=892 +package.editor.x=255 +package.editor.y=23 +package.frame.height=709 +package.frame.width=1018 package.numDependencies=3 package.numTargets=4 package.showExtends=true