by S1mb4 D4 L10n » July 27th, 2015, 7:36 am
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_W, 0, false), "NORTH");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_S, 0, false), "SOUTH");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, 0, false), "WEST");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_D, 0, false), "EAST");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_W, 0, true), "NORTHfalse");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_S, 0, true), "SOUTHfalse");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, 0, true), "EASTfalse");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_D, 0, true), "WESTfalse");
this.getActionMap().put("NORTHfalse", new stopvert());
this.getActionMap().put("SOUTHfalse", new stopvert());
this.getActionMap().put("EASTfalse", new stophoriz());
this.getActionMap().put("WESTfalse", new stophoriz());
this.getActionMap().put("NORTH", new moveup());
this.getActionMap().put("SOUTH", new movedown());
this.getActionMap().put("EAST", new moveright());
this.getActionMap().put("WEST", new moveleft());