computor Posted May 2, 2015 Share Posted May 2, 2015 I have everything, I think. How do I get the keys pressed to log "doing shit". Nothing happens currently when I run it. Quote Link to comment Share on other sites More sharing options...
Joseph Posted May 2, 2015 Share Posted May 2, 2015 (edited) Do you see that keyevent use the argument to know when the key has been pressed You talk about mouse pressed title. But in the op it talks about key pressed Edited May 2, 2015 by josedpay Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted May 2, 2015 Share Posted May 2, 2015 Did you register this as a new listener? Quote Link to comment Share on other sites More sharing options...
computor Posted May 2, 2015 Author Share Posted May 2, 2015 Do you see that keyevent use the argument to know when the key has been pressed You talk about mouse pressed title. But in the op it talks about key pressed I meant keyListener Did you register this as a new listener? That is literally everything in my code. Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted May 2, 2015 Share Posted May 2, 2015 I meant keyListener That is literally everything in my code. You need to register the listener to your script. Right now you basically made it but didn't attach it to anything. Quote Link to comment Share on other sites More sharing options...
computor Posted May 2, 2015 Author Share Posted May 2, 2015 You need to register the listener to your script. Right now you basically made it but didn't attach it to anything. How do you do that? Quote Link to comment Share on other sites More sharing options...
Joseph Posted May 2, 2015 Share Posted May 2, 2015 You need to register the listener to your script. Right now you basically made it but didn't attach it to anything.I don't see anything to add key listener.Op I do know in keyboard class you can grab the key Listener class.so use that instance to do want you need Quote Link to comment Share on other sites More sharing options...
Soldtodie Posted May 2, 2015 Share Posted May 2, 2015 getBot().getCanvas().addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } }); 3 Quote Link to comment Share on other sites More sharing options...
Joseph Posted May 2, 2015 Share Posted May 2, 2015 (edited) getBot().getCanvas().addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } }); Oh nice op seeing as you already implemented the interface. Just do in the onStart getBot().getCanvas().addKeyListener(this); Edited May 2, 2015 by josedpay Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted May 2, 2015 Share Posted May 2, 2015 getBot().getCanvas().addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } }); Thanks, I paseed tf out l0l Quote Link to comment Share on other sites More sharing options...
computor Posted May 3, 2015 Author Share Posted May 3, 2015 getBot().getCanvas().addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } }); Exactly what I needed. Thank you. Quote Link to comment Share on other sites More sharing options...