public void setWorld(Environment w) { world.clean(); for (RenderableObject o : w.getObjects()) { world.add(o); } this.world.repaint(); }
public MainFrame() { super(new MainFrameListener(), new Dimension(1024, 768)); setSize(frameSize); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); cmd = new CommandHandler(frameListener); cmd.start(); frameLocation = new Point(0, 0); world = new DefaultEnvironment(); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addComponent(world, GroupLayout.DEFAULT_SIZE, 1008, Short.MAX_VALUE)); groupLayout.setVerticalGroup( groupLayout .createParallelGroup(Alignment.LEADING) .addComponent(world, GroupLayout.DEFAULT_SIZE, 709, Short.MAX_VALUE)); getContentPane().setLayout(groupLayout); world.addMouseListener(frameListener); setupFrame(); setupMenu(); setupPopup(); setVisible(true); }
public void newWorld() { world.newWorld(); }
public ArrayList<RenderableObject> getObjects() { return world.getObjects(); }