private void registerKeyboardCommands(MegaMekController controller) { if (controller == null) { return; } // Register the action for CLEAR controller.registerCommandAction(KeyCommandBind.CANCEL.cmd, new CommandAction() { @Override public boolean shouldPerformAction() { if (!bv.getChatterBoxActive()) { return false; } else { return true; } } @Override public void performAction() { clearMessage(); slideDown(); } }); }
/** * Each KeyCommand has a built-in default; if now key binding file can be * found, we should register those defaults. * * @param controller */ public static void registerDefaultKeyBinds(MegaMekController controller) { for (KeyCommandBind kcb : KeyCommandBind.values()) { controller.registerKeyCommandBind(kcb); } }
@Override public void windowClosing(WindowEvent e) { frame.setVisible(false); setMapVisible(false); if (controller != null) { controller.removeAllActions(); controller.boardEditor = null; } } });
public void createController(){ controller = new MegaMekController(); KeyboardFocusManager kbfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); kbfm.addKeyEventDispatcher(controller); KeyBindParser.parseKeyBindings(controller); }
keyBind.modifiers = modifiers; keyBind.isRepeatable = isRepeatable; controller.registerKeyCommandBind(keyBind); System.err.println("Error parsing key bindings!"); e.printStackTrace(System.err); controller.removeAllKeyCommandBinds(); registerDefaultKeyBinds(controller);
startRepeating(kcb, action); } else { action.performAction(); stopRepeating(kcb);
public void actionPerformed(ActionEvent e) { if (isIgnoringEvents()) { return; } if (clientgui.isProcessingPointblankShot()) { ready(); // When the turn is ended, we could miss a key release event // This will ensure no repeating keys are stuck down clientgui.controller.stopAllRepeating(); } } });
public void createController() { controller = new MegaMekController(); KeyboardFocusManager kbfm = KeyboardFocusManager .getCurrentKeyboardFocusManager(); kbfm.addKeyEventDispatcher(controller); KeyBindParser.parseKeyBindings(controller); }
public void actionPerformed(ActionEvent e) { if (isIgnoringEvents()) { return; } if (clientgui.getClient().isMyTurn() || (clientgui.getClient().getGame().getTurn() == null)) { ready(); // When the turn is ended, we could miss a key release // event // This will ensure no repeating keys are stuck down clientgui.controller.stopAllRepeating(); } } });
controller.registerCommandAction(KeyCommandBind.AUTO_ARTY_DEPLOYMENT_ZONE.cmd, new CommandAction() {
controller.removeAllActions(); controller.clientgui = null;
final MegaMekController controller) { controller.registerCommandAction(KeyCommandBind.UD_GENERAL.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.UD_PILOT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.UD_ARMOR.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.UD_SYSTEMS.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.UD_WEAPONS.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.UD_EXTRAS.cmd, new CommandAction() {
clientgui.controller.registerCommandAction(KeyCommandBind.DONE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.UNDO.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TWIST_LEFT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TWIST_RIGHT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.FIRE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_WEAPON.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_WEAPON.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_MODE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_MODE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.CANCEL.cmd, new CommandAction() {
controller.registerCommandAction(KeyCommandBind.TURN_LEFT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TURN_RIGHT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.UNDO.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_UNIT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_UNIT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.MOVE_ENVELOPE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.CANCEL.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TOGGLE_MOVEMODE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TOGGLE_CONVERSIONMODE.cmd, new CommandAction() {
controller.registerCommandAction(KeyCommandBind.TOGGLE_ISO.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TOGGLE_CHAT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TOGGLE_CHAT_CMD.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.CENTER_ON_SELECTED.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.SCROLL_NORTH.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.SCROLL_SOUTH.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.SCROLL_EAST.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.SCROLL_WEST.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.FIELD_FIRE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TOGGLE_DRAW_LABELS.cmd, new CommandAction() {
controller.registerCommandAction(KeyCommandBind.UNDO.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TWIST_LEFT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TWIST_RIGHT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.FIRE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_WEAPON.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_WEAPON.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_UNIT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_UNIT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_TARGET.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_TARGET.cmd, new CommandAction() {
clientgui.controller.registerCommandAction(KeyCommandBind.DONE.cmd, new CommandAction() {
controller.registerCommandAction(KeyCommandBind.UNDO.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TWIST_LEFT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.TWIST_RIGHT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.FIRE.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_WEAPON.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_WEAPON.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_UNIT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_UNIT.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.NEXT_TARGET.cmd, new CommandAction() { controller.registerCommandAction(KeyCommandBind.PREV_TARGET.cmd, new CommandAction() {