Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm exam 2 review Fall2006: Make a Scene

Back to Midterm Exam 2 Review Fall2006

Questions? Answers? Comments?

I'm a little confused here. How do we know where each picture will be drawn? Will the linkedlist just display left to right all the picures?


public class PSETest {
public static void main(String [] args) {

Picture dog = new Picture(FileChooser.getMediaPath("dog-blue.jpg"));
PositionedSceneElement dognode = new PositionedSceneElement(dog.scale(.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"));

/Picture house = new Picture(FileChooser.getMediaPath("house-blue.jpg"));

Picture bg2 = new Picture(400,400);

keyur patel

In the above code the last five lines are commented, please disregard them. kp

Instead of creating 3 separate instances of PSE for housenode and treenode, can we use repeatNext() when creating the linked list?


Link to this Page