boardL = new Label("Board:", Label.LEFT); boardNewB = new Button("New..."); boardNewB.setActionCommand("board_new"); boardNewB.addActionListener(this); boardLoadB = new Button("Load..."); boardLoadB.setActionCommand("board_load"); boardLoadB.addActionListener(this); boardSaveB = new Button("Save"); boardSaveB.setActionCommand("board_save"); boardSaveB.addActionListener(this); boardSaveAsB = new Button("Save As..."); boardSaveAsB.setActionCommand("board_saveas"); boardSaveAsB.addActionListener(this);
butAddTerrain = new Button("Add/Set Terrain"); butAddTerrain.addActionListener(this);  panTerrainType = new Panel(new BorderLayout()); panTerrainType.add(choTerrainType, BorderLayout.WEST); panTerrainType.add(texTerrainLevel, BorderLayout.CENTER);  cheTerrExitSpecified = new Checkbox("Set Exits : "); butTerrExits = new Button("A"); texTerrExits = new TextField("0", 1); butTerrExits.addActionListener(this);  panTerrExits = new Panel(new FlowLayout()); panTerrExits.add(cheTerrExitSpecified); panTerrExits.add(butTerrExits); panTerrExits.add(texTerrExits);  labBoard = new Label("Board:", Label.LEFT); butBoardNew = new Button("New..."); butBoardNew.addActionListener(this);  butBoardLoad = new Button("Load..."); butBoardLoad.addActionListener(this);  butBoardSave = new Button("Save"); butBoardSave.addActionListener(this);  butBoardSaveAs = new Button("Save As..."); butBoardSaveAs.addActionListener(this);  panButtons = new Panel(new GridLayout(2, 2, 2, 2)); panButtons.add(butBoardNew); panButtons.add(butBoardLoad); panButtons.add(butBoardSave); panButtons.add(butBoardSaveAs);
    public BoardEditor(Frame frame, Board board, BoardView1 bv) {        this.frame = frame;        this.board = board;        this.bv = bv;                board.newData(0, 0, new Hex[0]);                frame.setTitle("MegaMek Editor : Unnamed");                nameL = new Label("Name (no tile selected)", Label.CENTER);        typeL = new Label("Type (no tile selected)", Label.CENTER);        hexC = new HexCanvas();        elevL = new Label("Elevation:", Label.RIGHT);        elevC = new Choice();        for(int i = 9; i > -6; i--) {            elevC.add("" + i);        }        elevC.select("0");        elevC.addItemListener(this);                loadedL = new Label("Hexes Loaded:", Label.LEFT);        loadedList = new List(10);        loadedList.addItemListener(this);        refreshTerrainList();        loadHexesB = new Button("Load More Hexes...");        loadHexesB.setActionCommand("hexes_load");        loadHexesB.addActionListener(this);        clearUnusedB = new Button("Clear Unused Hexes");        clearUnusedB.setActionCommand("hexes_clear");        clearUnusedB.addActionListener(this);                boardL = new Label("Board:", Label.LEFT);        boardNewB = new Button("New...");        boardNewB.setActionCommand("board_new");        boardNewB.addActionListener(this);        boardLoadB = new Button("Load...");        boardLoadB.setActionCommand("board_load");        boardLoadB.addActionListener(this);        boardSaveB = new Button("Save");        boardSaveB.setActionCommand("board_save");        boardSaveB.addActionListener(this);        boardSaveAsB = new Button("Save As...");        boardSaveAsB.setActionCommand("board_saveas");        boardSaveAsB.addActionListener(this);                blankL = new Label("", Label.CENTER);                GridBagLayout gridbag = new GridBagLayout();        GridBagConstraints c = new GridBagConstraints();        setLayout(gridbag);                c.fill = GridBagConstraints.HORIZONTAL;        c.weightx = 0.0;    c.weighty = 0.0;        c.insets = new Insets(4, 4, 1, 1);                c.gridwidth = GridBagConstraints.REMAINDER;         addBag(nameL, gridbag, c);        addBag(hexC, gridbag, c);        addBag(typeL, gridbag, c);        c.gridwidth = 1;         addBag(elevL, gridbag, c);        c.gridwidth = GridBagConstraints.REMAINDER;         addBag(elevC, gridbag, c);                addBag(loadedL, gridbag, c);        addBag(loadedList, gridbag, c);        addBag(loadHexesB, gridbag, c);        addBag(clearUnusedB, gridbag, c);            c.weightx = 1.0;    c.weighty = 1.0;        addBag(blankL, gridbag, c);                c.weightx = 0.0;    c.weighty = 0.0;        addBag(boardL, gridbag, c);        c.gridwidth = 1;         addBag(boardNewB, gridbag, c);        c.gridwidth = GridBagConstraints.REMAINDER;         addBag(boardLoadB, gridbag, c);        c.gridwidth = 1;         addBag(boardSaveB, gridbag, c);        c.gridwidth = GridBagConstraints.REMAINDER;         addBag(boardSaveAsB, gridbag, c);    }