m.add(boundaryMenuItem);
    private void createMenuBar() {        ImageIcon iconRot90 = null, iconRot180 = null, iconRot270 = null;        ImageIcon iconFlipHor = null, iconFlipVer = null;        JMenu m;        try {            iconRot90 = new ImageIcon(loadImageResource(                        "resources/gimp-rotate-90-16.png"));            iconRot180 = new ImageIcon(loadImageResource(                        "resources/gimp-rotate-180-16.png"));            iconRot270 = new ImageIcon(loadImageResource(                        "resources/gimp-rotate-270-16.png"));            iconFlipHor = new ImageIcon(loadImageResource(                        "resources/gimp-flip-horizontal-16.png"));            iconFlipVer = new ImageIcon(loadImageResource(                        "resources/gimp-flip-vertical-16.png"));        } catch (IOException e) {            e.printStackTrace();        }        menuBar = new JMenuBar();        JMenuItem save = createMenuItem("Save", null, "Save current map",                "control S");        JMenuItem saveAs = createMenuItem("Save as...", null,                "Save current map as new file", "control shift S");        JMenuItem close = createMenuItem("Close", null, "Close this map",                "control W");        JMenuItem print =            createMenuItem("Print...", null, "Print the map", "control P");        recentMenu = new JMenu("Open Recent");        mapEventAdapter.addListener(save);        mapEventAdapter.addListener(saveAs);        mapEventAdapter.addListener(close);        mapEventAdapter.addListener(print);        m = new JMenu("File");        m.add(createMenuItem("New", null, "Start a new map", "control N"));        m.add(createMenuItem("Open...", null, "Open a map", "control O"));        m.add(recentMenu);        m.add(save);        m.add(saveAs);        // TODO: Re-add print menuitem when printing is functional        //m.addSeparator();        //m.add(print);		//mapEventAdapter.addListener(print);        m.addSeparator();        m.add(close);        m.add(createMenuItem("Exit", null, "Exit the map editor", "control Q"));        menuBar.add(m);        undoMenuItem = createMenuItem("Undo", null, "Undo one action",                "control Z");        undoMenuItem.setEnabled(false);        redoMenuItem = createMenuItem("Redo", null, "Redo one action",                "control Y");        redoMenuItem.setEnabled(false);        mRot90 = createMenuItem("Rotate 90 degrees CW",                iconRot90, "Rotate 90 degrees clockwise");        mRot180 = createMenuItem("Rotate 180 degrees CW",                iconRot180, "Rotate 180 degrees clockwise");        mRot270 = createMenuItem("Rotate 90 degrees CCW",                iconRot270, "Rotate 90 degrees counterclockwise");        mFlipHor = createMenuItem("Flip Horizontal",                iconFlipHor, "Flip the map horizontally");        mFlipVer = createMenuItem("Flip Vertical",                iconFlipVer, "Flip the map vertically");        JMenu transformSub = new JMenu("Transform");        transformSub.add(mRot90);        transformSub.add(mRot270);        transformSub.add(mRot180);        transformSub.addSeparator();        transformSub.add(mFlipHor);        transformSub.add(mFlipVer);        mapEventAdapter.addListener(transformSub);        m = new JMenu("Edit");        m.add(undoMenuItem);        m.add(redoMenuItem);        m.addSeparator();        m.add(transformSub);		        m.addSeparator();        m.add(createMenuItem("Preferences...",                    null, "Configure options of the editor", null));        mapEventAdapter.addListener(undoMenuItem);        mapEventAdapter.addListener(redoMenuItem);        menuBar.add(m);        m = new JMenu("Map");        m.add(createMenuItem("Resize", null, "Modify map dimensions"));        m.addSeparator();        m.add(createMenuItem("Properties", null, "Map properties"));        mapEventAdapter.addListener(m);        menuBar.add(m);        layerAdd = createMenuItem("Add Layer", null, "Add a layer");        layerClone = createMenuItem("Duplicate Layer", null,                "Duplicate current layer");        layerDel = createMenuItem("Delete Layer", null,                "Delete current layer");        layerUp = createMenuItem("Move Layer Up", null,                "Move layer up one in layer stack", "shift PAGE_UP");        layerDown = createMenuItem("Move Layer Down", null,                "Move layer down one in layer stack", "shift PAGE_DOWN");        layerMerge = createMenuItem("Merge Down", null,                "Merge current layer onto next lower", "shift control M");        layerMergeAll = createMenuItem("Merge All", null, "Merge all layers");        mapEventAdapter.addListener(layerAdd);        m = new JMenu("Layer");        m.add(layerAdd);        m.add(layerClone);        m.add(layerDel);        m.addSeparator();        m.add(layerUp);        m.add(layerDown);        m.addSeparator();        m.add(layerMerge);        m.add(layerMergeAll);        mapEventAdapter.addListener(m);        menuBar.add(m);        m = new JMenu("Tilesets");        m.add(createMenuItem("New tileset...", null,                    "Add a new internal tileset"));        m.add(createMenuItem("Import tileset...", null,                    "Import an external tileset"));        m.addSeparator();        m.add(createMenuItem("Tileset Manager", null,                    "Open the tileset manager"));        mapEventAdapter.addListener(m);        menuBar.add(m);        /*        m = new JMenu("Objects");        m.add(createMenuItem("Add Object", null, "Add an object"));        mapEventAdapter.addListener(m);        menuBar.add(m);        JMenu modifySub = new JMenu("Modify");        modifySub.add(createMenuItem("Expand Selection", null, ""));        modifySub.add(createMenuItem("Contract Selection", null, ""));        m = new JMenu("Select");        m.add(createMenuItem("All", null, "Select entire map"));        m.add(createMenuItem("Deselect", null, "Cancel Selection"));        m.add(createMenuItem("Inverse", null, "Invert Selection"));        m.addSeparator();        m.add(modifySub);        mapEventAdapter.addListener(m);        menuBar.add(m);        */        zoomIn = createMenuItem("Zoom In", null, "Zoom in one level",                "control EQUALS");        zoomOut = createMenuItem("Zoom Out", null, "Zoom out one level",                "control MINUS");        zoomNormal = createMenuItem("Zoom Normalsize", null, "Zoom 100%",                "control 1");        gridMenuItem = new JCheckBoxMenuItem("Show Grid");        gridMenuItem.addActionListener(this);        gridMenuItem.setToolTipText("Toggle grid");        gridMenuItem.setAccelerator(KeyStroke.getKeyStroke("control G"));        m = new JMenu("View");        m.add(zoomIn);        m.add(zoomOut);        m.add(zoomNormal);        m.addSeparator();        m.add(gridMenuItem);        mapEventAdapter.addListener(m);        menuBar.add(m);        m = new JMenu("Help");        m.add(createMenuItem("About", null, "Show about window"));        menuBar.add(m);    }