public MapEdit() {
		// gfx = new GraphicsBank();
		zoomLevel = 1;
		openFile = null;
		try {
			scene = Scene.loadScene("lastOpenScene.dat", false);
		} catch (IOException e) {
			scene = new Scene();
		}

		map = scene.getMap();
		gfx = scene.getTileset();
		/* so that the window contents resize while you drag. */
		Toolkit.getDefaultToolkit().setDynamicLayout(true);

		mainFrame = new JFrame();
		mainFrame.setTitle("Map Editor by Judd Modify By Peter");
		ImageIcon img = new ImageIcon("icons/icon.png");
		mainFrame.setIconImage(img.getImage());

		tileChooser = new TileChooser(gfx, mainFrame);
		chooser = new JFileChooser("scenes");
		tschooser = new JFileChooser("gfx");

		/*
		 * outer-most containers actually reserved for docking the toolbars. so
		 * "cp" is actually not the contentpane of the JPanel, but let's ignore
		 * that.
		 */
		JPanel outerToolPane = (JPanel) mainFrame.getContentPane();
		JPanel innerToolPane = new JPanel(new BorderLayout());
		JPanel cp = new JPanel(new BorderLayout());

		outerToolPane.setLayout(new BorderLayout());
		outerToolPane.add(innerToolPane, BorderLayout.CENTER);
		innerToolPane.add(cp, BorderLayout.CENTER);

		colorDialog = createColorDialog();

		setupMenus();

		setupToolbars();

		cp.setLayout(new BorderLayout());

		/* Toolbar placement */
		innerToolPane.add(innerToolBar, BorderLayout.NORTH);
		outerToolPane.add(outerToolBar, BorderLayout.NORTH);

		/* TileChooser placement */
		chooserPanel = new JPanel(new BorderLayout());

		// chooserPanel.setBorder(new TitledBorder("chooserPanel"));
		JScrollPane tileScroll = new JScrollPane(tileChooser);
		chooserPanel.add(tileScroll, BorderLayout.CENTER);
		JTabbedPane tabPane = new JTabbedPane();
		tabPane.add("Tiles", chooserPanel);

		tilesetFileLabel = new JLabel("Tileset: * unsaved *");
		tilesetInfoPane = new JPanel(new BorderLayout());
		// tilesetInfoPane.setBorder(new TitledBorder("tilesetInfoPane"));
		JPanel tilesetInfoBtnPane = new JPanel(new FlowLayout());
		// tilesetInfoBtnPane.setBorder(new TitledBorder("tilesetInfoBtnPane"));
		tilesetInfoPane.add(tilesetInfoBtnPane, BorderLayout.CENTER);
		chooserPanel.add(tilesetInfoPane, BorderLayout.SOUTH);
		tilesetInfoPane.add(tilesetFileLabel, BorderLayout.NORTH);

		String basepath = "../../";
		tilesetOpenBtn = makeBtn("Open", basepath + "icons/opents.gif", "Load Tileset");
		tilesetNewBtn = makeBtn("New", basepath + "icons/newts.gif", "New Tileset");
		tilesetSaveBtn = makeBtn("Save", basepath + "icons/savets.gif", "Save Tileset");
		tilesetInfoBtnPane.add(tilesetOpenBtn);
		tilesetInfoBtnPane.add(tilesetNewBtn);
		tilesetInfoBtnPane.add(tilesetSaveBtn);

		/* Settings panel */
		settingsPanel = new JPanel(new BorderLayout());
		settingsPanel.setBorder(new TitledBorder("Settings"));
		settingsPanel.add(colorDialog, BorderLayout.CENTER);

		tabPane.add("Settings", settingsPanel);

		/* Scrollable map panel creation and placement */
		mapPanel = new MapComponent(map, this);

		mapScroll = new JScrollPane(mapPanel);
		mapPanel.setViewport(mapScroll.getViewport());

		/* Divider between map panel and tile chooser */
		split = new JSplitPane();
		split.setDividerLocation(250);
		split.setLeftComponent(tabPane);
		split.setRightComponent(mapScroll);
		cp.add(split, BorderLayout.CENTER);
		/* NOTE: Creation of an anonymous inner class */
		split.addPropertyChangeListener(new PropertyChangeListener() {
			public void propertyChange(PropertyChangeEvent ev) {
				tileChooser.setWidth(split.getDividerLocation());
			}
		});

		/* Sizing and positioning the window, general JFrame setup */
		mainFrame.setSize(new Dimension(830, 650));
		mainFrame.setLocationRelativeTo(null);
		mainFrame.setVisible(true);
		mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		/* Positioning of the colour chooser dialog */
		// colorDialog.setLocationRelativeTo(mainFrame);

		/*
		 * Continuous repaint every second. This should be eliminated. If it is
		 * even necessary at all, it's only due to bugs.
		 */
		while (true) {
			mapPanel.repaint();
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				System.out
						.println("wow... an interrupted exception. Never seen one before.");
			}
		}
	}