public ShapeExplorer(final Simulation model) {
		super("Shape Expolorer");
		this.model = model;

		icon = new ImageIcon(getClass().getResource(
				MainWindow.RESOURCE_PATH + "folder.png"));
		setIconImage(icon.getImage());

		// Create the list of shapes:
		createNodes();

		shapeList = new JTree(treeModel) {
			{
				model.addPhysicsListener(new PhysicsListener() {
					@Override
					public void stateChanged(PhysicsEvent e) {
						repaint();
					}
				});
			}
			
			@Override
			protected void paintComponent(Graphics g) {
				super.paintComponent(g);
			}
		};
		shapeList.getSelectionModel().setSelectionMode(
				TreeSelectionModel.SINGLE_TREE_SELECTION);
		shapeList.setShowsRootHandles(true);
		shapeListHolder = new JScrollPane(shapeList);

		shapeList.setCellRenderer(new ShapeNodeRenderer());

		shapeView = new ShapeView(model);
		shapeViewHolder = new JScrollPane(shapeView);

		view = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
				shapeListHolder, shapeViewHolder);
		view.setOneTouchExpandable(true);
		view.setDividerLocation(150);
		view.setResizeWeight(0.0);
		add(view);

		model.addBodySetListener(new BodySetListener() {
			@Override
			public void bodyAdded(BodySetEvent e) {
				addBodyNode(e.getBody());
			}

			@Override
			public void bodyRemoved(BodySetEvent e) {
				removeBodyNode(e.getBody());
			}
		});

		shapeList.addTreeSelectionListener(new TreeSelectionListener() {
			@Override
			public void valueChanged(TreeSelectionEvent e) {
				if (shapeList.getLastSelectedPathComponent() instanceof ShapeNode) {
					ShapeNode node = (ShapeNode) shapeList
							.getLastSelectedPathComponent();
					Body body = node.getBody();
					shapeView.setBody(body);
				}

				else {
					shapeView.setBody(null);
				}
			}
		});

		shapeList.setFocusable(true);
		shapeList.addKeyListener(new KeyAdapter() {

			Simulation model = ShapeExplorer.this.model;

			@Override
			public void keyPressed(KeyEvent e) {
				switch (e.getKeyCode()) {
				case KeyEvent.VK_DELETE:
				case KeyEvent.VK_BACK_SPACE:
					if (shapeView.getBody() != null) {
						if (shapeView.getBody().getType() != Body.WALL) {
							this.model.removeBody(shapeView.getBody());
						}
					}
					break;
				}
			}
		});

		setDefaultCloseOperation(HIDE_ON_CLOSE);
		setSize(450, 400);
		setLocationRelativeTo(null);
	}