Advertisement
Guest User

Untitled

a guest
Dec 6th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.util.Scanner;
  4.  
  5. import se.lth.cs.ptdc.window.SimpleWindow;
  6.  
  7.  
  8. public class ShapeTest {
  9.     public static void main(String[] args) throws FileNotFoundException {
  10.         SimpleWindow w = new SimpleWindow(600, 600, "ShapeTest");
  11.         ShapeList shapes = new ShapeList();
  12.         Scanner scan = new Scanner(new File("shapedata.txt"));
  13.         int x,y,z;
  14.         while(scan.hasNext()) {
  15.             String s = scan.next();
  16.             if (s == "S"){
  17.                 x = scan.nextInt();
  18.                 y = scan.nextInt();
  19.                 z = scan.nextInt();
  20.                 shapes.insert(new Square(x,y,z));
  21.             } else if (s == "C") {
  22.                 x = scan.nextInt();
  23.                 y = scan.nextInt();
  24.                 z = scan.nextInt();
  25.                 shapes.insert(new Circle(x,y,z));
  26.             } else if (s == "T") {
  27.                 x = scan.nextInt();
  28.                 y = scan.nextInt();
  29.                 z = scan.nextInt();
  30.                 shapes.insert(new Square(x,y,z));
  31.             }
  32.                
  33.         }
  34.         shapes.draw(w);
  35. //      shapes.insert(new Square(100, 300, 100));
  36. //        shapes.insert(new Triangle(400, 200, 100));
  37. //        shapes.insert(new Circle(400, 400, 50));
  38. //        shapes.insert(new Square(450, 450, 50));
  39. //        shapes.insert(new Square(200, 200, 35));
  40. //        shapes.draw(w);
  41.         CommandDispatcher cd = new CommandDispatcher(w,shapes);
  42.         cd.mainLoop();
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement