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

Midterm exam 2 review Sp2005: Make a Scene

Back to Midterm Exam 2 Review Sp2005

Questions, comments, answers, etc.



Is the dog the only one you want to be scaled?

For this example, sure. Mark Guzdial


public class PSETest {
  public static void main(String [] args) {
    FileChooser.setMediaPath("D:/cs1316/mediasources/");
    
    Picture dog = new Picture(FileChooser.getMediaPath("dog-blue.jpg"));
    Picture dog = dog.scale(.25);
    PositionedSceneElement dognode = new PositionedSceneElement(dog);

    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);
    
    treenode.setNext(dognode); 
    dognode.setNext(housenode);
    housenode.setNext(housenode2);
    housenode2.setNext(housenode3);
    housenode3.setNext(treenode);
    treenode.setNext(treenode2);
    treenode2.setNext(treenode3);
    
    Picture bg = new Picture("jungle.jpg");
    treenode.drawFromMeOn(bg);
    bg.show();

  }
}




Link to this Page