Midterm exam 2 review Fall2005: Make a Scene
Post questions, comments, answers, comments on answers, etc. here.
(Return to Midterm Exam 2 Review Fall2005)
//lovely
public class PSETest2{
public static void main(String [] args) {
FileChooser.setMediaPath("C:/Program Files/cs1316/mediasources/");
Picture dog = new Picture(FileChooser.getMediaPath("dog-blue.jpg"));
PositionedSceneElement dognode = new PositionedSceneElement(dog.scale(0.25));
Picture house = new Picture(FileChooser.getMediaPath("house-blue.jpg"));
PositionedSceneElement housenode = new PositionedSceneElement(house);
PositionedSceneElement housenode2 = new PositionedSceneElement(house);
PositionedSceneElement housenode3 = new PositionedSceneElement(house);
Picture tree = new Picture(FileChooser.getMediaPath("tree-blue.jpg"));
PositionedSceneElement treenode = new PositionedSceneElement(tree);
PositionedSceneElement treenode2 = new PositionedSceneElement(tree);
PositionedSceneElement treenode3 = new PositionedSceneElement(tree);
dognode.setNext(housenode); housenode.setNext(housenode2); housenode2.setNext(housenode3);
housenode3.setNext(treenode); treenode.setNext(treenode2); treenode2.setNext(treenode3);
Picture bg = new Picture(FileChooser.getMediaPath("jungle.jpg"));
dognode.drawFromMeOn(bg);
bg.show();
}
}
Removed at KS request
Link to this Page