Skip to content
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
71 changes: 48 additions & 23 deletions Picture/Picture.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,42 +33,64 @@ 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();
}

/**
* Change this picture to black/white display
*/
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");
}
}

Expand All @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion Picture/Square.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public Square()
size = 30;
xPosition = 60;
yPosition = 50;
color = "red";
color = "white";
isVisible = false;
}

Expand Down
37 changes: 17 additions & 20 deletions Picture/package.bluej
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BlueJ-DreamHouseDrawing
# FirstLab-Shapes

This is the first BlueJ lab.

Expand All @@ -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.
3 changes: 2 additions & 1 deletion Shapes/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public Circle()
*/
public void makeVisible()
{
isVisible = true;
isVisible = false
;
draw();
}

Expand Down
32 changes: 16 additions & 16 deletions Shapes/package.bluej
Original file line number Diff line number Diff line change
@@ -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
Expand Down