Skip to content

Instantly share code, notes, and snippets.

@ZachMassia
Last active December 11, 2015 12:29
Show Gist options
  • Select an option

  • Save ZachMassia/4601240 to your computer and use it in GitHub Desktop.

Select an option

Save ZachMassia/4601240 to your computer and use it in GitHub Desktop.
Move bot with up arrow
mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("UP"), "moveUp");
mainPanel.getActionMap().put("moveUp", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
bot.moveUp();
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment