buttonsMech = new ArrayList(22);
buttonsMech = new ArrayList<Button>(22);
    public MovementDisplay(ClientGUI clientgui) {        this.clientgui = clientgui;        this.client = clientgui.getClient();        client.game.addGameListener(this);        gear = MovementDisplay.GEAR_LAND;        shiftheld = false;        clientgui.getBoardView().addBoardViewListener(this);        setupStatusBar(Messages.getString("MovementDisplay.waitingForMovementPhase")); //$NON-NLS-1$        butClear = new Button(Messages.getString("MovementDisplay.butClear")); //$NON-NLS-1$        butClear.addActionListener(this);        butClear.setEnabled(false);        butClear.setActionCommand(MOVE_CLEAR);        butClear.addKeyListener(this);        butWalk = new Button(Messages.getString("MovementDisplay.butWalk")); //$NON-NLS-1$        butWalk.addActionListener(this);        butWalk.setEnabled(false);        butWalk.setActionCommand(MOVE_WALK);        butWalk.addKeyListener(this);        butJump = new Button(Messages.getString("MovementDisplay.butJump")); //$NON-NLS-1$        butJump.addActionListener(this);        butJump.setEnabled(false);        butJump.setActionCommand(MOVE_JUMP);        butJump.addKeyListener(this);        butSwim = new Button(Messages.getString("MovementDisplay.butSwim")); //$NON-NLS-1$        butSwim.addActionListener(this);        butSwim.setEnabled(false);        butSwim.setActionCommand(MOVE_SWIM);        butSwim.addKeyListener(this);        butBackup = new Button(Messages.getString("MovementDisplay.butBackup")); //$NON-NLS-1$        butBackup.addActionListener(this);        butBackup.setEnabled(false);        butBackup.setActionCommand(MOVE_BACK_UP);        butBackup.addKeyListener(this);        butTurn = new Button(Messages.getString("MovementDisplay.butTurn")); //$NON-NLS-1$        butTurn.addActionListener(this);        butTurn.setEnabled(false);        butTurn.setActionCommand(MOVE_TURN);        butTurn.addKeyListener(this);        butUp = new Button(Messages.getString("MovementDisplay.butUp")); //$NON-NLS-1$        butUp.addActionListener(this);        butUp.setEnabled(false);        butUp.setActionCommand(MOVE_GET_UP);        butUp.addKeyListener(this);        butDown = new Button(Messages.getString("MovementDisplay.butDown")); //$NON-NLS-1$        butDown.addActionListener(this);        butDown.setEnabled(false);        butDown.setActionCommand(MOVE_GO_PRONE);        butDown.addKeyListener(this);        butCharge = new Button(Messages.getString("MovementDisplay.butCharge")); //$NON-NLS-1$        butCharge.addActionListener(this);        butCharge.setEnabled(false);        butCharge.setActionCommand(MOVE_CHARGE);        butCharge.addKeyListener(this);        butDfa = new Button(Messages.getString("MovementDisplay.butDfa")); //$NON-NLS-1$        butDfa.addActionListener(this);        butDfa.setEnabled(false);        butDfa.setActionCommand(MOVE_DFA);        butDfa.addKeyListener(this);        butFlee = new Button(Messages.getString("MovementDisplay.butFlee")); //$NON-NLS-1$        butFlee.addActionListener(this);        butFlee.setEnabled(false);        butFlee.setActionCommand(MOVE_FLEE);        butFlee.addKeyListener(this);        butEject = new Button(Messages.getString("MovementDisplay.butEject")); //$NON-NLS-1$        butEject.addActionListener(this);        butEject.setEnabled(false);        butEject.setActionCommand(MOVE_EJECT);        butEject.addKeyListener(this);        butRAC = new Button(Messages.getString("MovementDisplay.butRAC")); //$NON-NLS-1$        butRAC.addActionListener(this);        butRAC.setEnabled(false);        butRAC.setActionCommand(MOVE_UNJAM);        butRAC.addKeyListener(this);        butSearchlight = new Button(Messages.getString("MovementDisplay.butSearchlightOn")); //$NON-NLS-1$        butSearchlight.addActionListener(this);        butSearchlight.setEnabled(false);        butSearchlight.setActionCommand(MOVE_SEARCHLIGHT);        butSearchlight.addKeyListener(this);        butMore = new Button(Messages.getString("MovementDisplay.butMore")); //$NON-NLS-1$        butMore.addActionListener(this);        butMore.setEnabled(false);        butMore.addKeyListener(this);        butNext = new Button(Messages.getString("MovementDisplay.butNext")); //$NON-NLS-1$        butNext.addActionListener(this);        butNext.setEnabled(false);        butNext.setActionCommand(MOVE_NEXT);        butNext.addKeyListener(this);        butDone = new Button(Messages.getString("MovementDisplay.butDone")); //$NON-NLS-1$        butDone.addActionListener(this);        butDone.setEnabled(false);        butDone.addKeyListener(this);        butLoad = new Button(Messages.getString("MovementDisplay.butLoad")); //$NON-NLS-1$        butLoad.addActionListener(this);        butLoad.setEnabled(false);        butLoad.setActionCommand(MOVE_LOAD);        butLoad.addKeyListener(this);        butUnload = new Button(Messages.getString("MovementDisplay.butUnload")); //$NON-NLS-1$        butUnload.addActionListener(this);        butUnload.setEnabled(false);        butUnload.setActionCommand(MOVE_UNLOAD);        butUnload.addKeyListener(this);                butRaise = new Button(Messages.getString("MovementDisplay.butRaise")); //$NON-NLS-1$        butRaise.addActionListener(this);        butRaise.setEnabled(false);        butRaise.setActionCommand(MOVE_RAISE_ELEVATION);        butRaise.addKeyListener(this);                butLower = new Button(Messages.getString("MovementDisplay.butLower")); //$NON-NLS-1$        butLower.addActionListener(this);        butLower.setEnabled(false);        butLower.setActionCommand(MOVE_LOWER_ELEVATION);        butLower.addKeyListener(this);                butLayMine = new Button(Messages.getString("MovementDisplay.butLayMine")); //$NON-NLS-1$        butLayMine.addActionListener(this);        butLayMine.setEnabled(false);        butLayMine.setActionCommand(MOVE_LAY_MINE);        butLayMine.addKeyListener(this);                butHullDown = new Button(Messages.getString("MovementDisplay.butHullDown")); //$NON-NLS-1$        butHullDown.addActionListener(this);        butHullDown.setEnabled(false);        butHullDown.setActionCommand(MOVE_HULL_DOWN);        butHullDown.addKeyListener(this);                butClimbMode = new Button(Messages.getString("MovementDisplay.butClimbMode")); //$NON-NLS-1$        butClimbMode.addActionListener(this);        butClimbMode.setEnabled(false);        butClimbMode.setActionCommand(MOVE_CLIMB_MODE);        butClimbMode.addKeyListener(this);                butDigIn = new Button(Messages.getString("MovementDisplay.butDigIn")); //$NON-NLS-1$        butDigIn.addActionListener(this);        butDigIn.setEnabled(false);        butDigIn.setActionCommand(MOVE_DIG_IN);        butDigIn.addKeyListener(this);                butFortify = new Button(Messages.getString("MovementDisplay.butFortify")); //$NON-NLS-1$        butFortify.addActionListener(this);        butFortify.setEnabled(false);        butFortify.setActionCommand(MOVE_FORTIFY);        butFortify.addKeyListener(this);                butShakeOff = new Button(Messages.getString("MovementDisplay.butShakeOff")); //$NON-NLS-1$        butShakeOff.addActionListener(this);        butShakeOff.setEnabled(false);        butShakeOff.setActionCommand(MOVE_SHAKE_OFF);        butShakeOff.addKeyListener(this);                butSpace = new Button(".");        butSpace.setEnabled(false);        butSpace.addKeyListener(this);                //add buttons to the lists, except space, more & next        buttonsMech = new ArrayList(22);        buttonsMech.add(butWalk);        buttonsMech.add(butJump);        buttonsMech.add(butBackup);        buttonsMech.add(butTurn);        buttonsMech.add(butUp);        buttonsMech.add(butDown);        buttonsMech.add(butCharge);        buttonsMech.add(butDfa);        buttonsMech.add(butLoad);        buttonsMech.add(butUnload);        buttonsMech.add(butClimbMode);        buttonsMech.add(butSearchlight);        buttonsMech.add(butHullDown);        buttonsMech.add(butSwim);        buttonsMech.add(butEject);        buttonsMech.add(butFlee);        buttonsMech.add(butRAC);        //these are last, they won't be used by mechs        buttonsMech.add(butDigIn);        buttonsMech.add(butFortify);        buttonsMech.add(butLayMine);        buttonsMech.add(butLower);        buttonsMech.add(butRaise);        buttonsMech.add(butShakeOff);        buttonsTank = new ArrayList(22);        buttonsTank.add(butWalk);        buttonsTank.add(butBackup);        buttonsTank.add(butTurn);        buttonsTank.add(butLoad);        buttonsTank.add(butUnload);        buttonsTank.add(butCharge);        buttonsTank.add(butClimbMode);        buttonsTank.add(butSearchlight);        buttonsTank.add(butHullDown);        buttonsTank.add(butSwim);        buttonsTank.add(butEject);        buttonsTank.add(butFlee);        buttonsTank.add(butRAC);        buttonsTank.add(butLayMine);        buttonsTank.add(butShakeOff);        //these are last, they won't be used by tanks        buttonsTank.add(butDfa);        buttonsTank.add(butUp);        buttonsTank.add(butDown);        buttonsTank.add(butJump);        buttonsTank.add(butDigIn);        buttonsTank.add(butFortify);        buttonsTank.add(butLower);        buttonsTank.add(butRaise);        buttonsVtol = new ArrayList(22);        buttonsVtol.add(butWalk);        buttonsVtol.add(butBackup);        buttonsVtol.add(butLower);        buttonsVtol.add(butRaise);        buttonsVtol.add(butTurn);        buttonsVtol.add(butLoad);        buttonsVtol.add(butUnload);        buttonsVtol.add(butSearchlight);        buttonsVtol.add(butEject);        buttonsVtol.add(butFlee);        buttonsVtol.add(butRAC);        buttonsVtol.add(butShakeOff);        //these are last, they won't be used by vtol        buttonsVtol.add(butHullDown);        buttonsVtol.add(butLayMine);        buttonsVtol.add(butSwim);        buttonsVtol.add(butClimbMode);        buttonsVtol.add(butCharge);        buttonsVtol.add(butDfa);        buttonsVtol.add(butUp);        buttonsVtol.add(butDown);        buttonsVtol.add(butJump);        buttonsVtol.add(butDigIn);        buttonsVtol.add(butFortify);        buttonsInf = new ArrayList(22);        buttonsInf.add(butWalk);        buttonsInf.add(butJump);        buttonsInf.add(butLower);        buttonsInf.add(butRaise);        buttonsInf.add(butTurn);        buttonsInf.add(butClimbMode);        buttonsInf.add(butSearchlight);        buttonsInf.add(butEject);        buttonsInf.add(butFlee);        buttonsInf.add(butRAC);        buttonsInf.add(butLayMine);        buttonsInf.add(butSwim);        buttonsInf.add(butDigIn);        buttonsInf.add(butFortify);        //these are last, they won't be used by infantry        buttonsInf.add(butLoad);        buttonsInf.add(butUnload);        buttonsInf.add(butBackup);        buttonsInf.add(butHullDown);        buttonsInf.add(butCharge);        buttonsInf.add(butDfa);        buttonsInf.add(butUp);        buttonsInf.add(butDown);        buttonsInf.add(butShakeOff);        // layout button grid        panButtons = new Panel();        buttonLayout = 0;        setupButtonPanel();        // layout screen        GridBagLayout gridbag = new GridBagLayout();        GridBagConstraints c = new GridBagConstraints();        setLayout(gridbag);        c.fill = GridBagConstraints.BOTH;        c.weightx = 1.0;    c.weighty = 1.0;        c.insets = new Insets(1, 1, 1, 1);//         c.gridwidth = GridBagConstraints.REMAINDER;//         addBag(clientgui.bv, gridbag, c);//         c.weightx = 1.0;    c.weighty = 0;//         c.gridwidth = 1;//         addBag(client.cb.getComponent(), gridbag, c);        c.gridwidth = GridBagConstraints.REMAINDER;        c.weightx = 0.0;    c.weighty = 0.0;        addBag(panButtons, gridbag, c);        c.weightx = 1.0;    c.weighty = 0.0;        c.gridwidth = GridBagConstraints.REMAINDER;        addBag(panStatus, gridbag, c);        clientgui.bv.addKeyListener( this );        addKeyListener( this );    }