Key Listener Programming Software Development by TheParadox Hello, I'm writing a keylogger program that (as the name states), logs all keystrokes into a .txt file. The problem I am encountering is adding the key listener. I know I have to add the key Listener to something, however is there a way to have the key listener always run no matter which component is in focus? Re: Key Logger vs Key Listener Programming Software Development by Vreality …]Hello, I am confused between the differences between a key logger and key listener in Java....i looked online but I couldn't… is a program you have to create that uses the key listener as a tool to "Listen" for when keys… are pressed. Maybe there is a key logger command I don't know of though... Does this… Key Logger vs Key Listener Programming Software Development by caswimmer2011 Hello, I am confused between the differences between a key logger and key listener in Java....i looked online but I couldn't find a straight-up answer. Thanks in advance! Re: Key Logger vs Key Listener Programming Software Development by Taywin You may search the Google for keylogger virus, and key listener... They are somewhat similar in functionality (capture user's key stroke), but they have different purposes in use. Re: Key Listener Programming Software Development by Ezzaral You are adding the key listener in your paint() method. Every time it gets called, you add another. Re: Key Listener Programming Software Development by Slyvr [QUOTE=Ezzaral;1525447]You are adding the key listener in your paint() method. Every time it gets called, you add another.[/QUOTE] Ahhh, thank you :D I cleaned up the code a bit now and trying to figure out how to repaint(); from inside the main class for the keylistener now... Application Key Listener not working Programming Software Development by sirlink99 I have this key listener in my application, and it wont work. This is my first key listener in an application, …however I have done a mouse listener in one before. Anyway…[/CODE] for some reason the key pressed method will not activate. I have added the listener and everything. Thanks for the … Re: Convert mouse listener to key listener Programming Software Development by JamesCherrill …focus is on the component that you added the listener to. So most of the time the keyboard…guess, then try adding the key listener to that component (or components - adding the listener to everying in sight often works…). Sun realised this problem, and implemented *key bindings* to avoid… Re: Convert mouse listener to key listener Programming Software Development by sk8er3577 … work when I try to just change it to a key listener. This is why I thought the method would have to… be rewritten. How can I make the key listener always focus the empty tile? That is the main problem… Convert mouse listener to key listener Programming Software Development by sk8er3577 …figure out is how I would convert the mouse listener to a key listener. I believe the checkEmpty, moveTile, and exchangeTile… constructor public SlidePuzzleGUI() { //--- Create a button. Add a listener to it. JButton newGameButton = new JButton("New Game"… Two in one: Mouse and key listener. Help needed. Programming Software Development by Alex_ Hi, i want to do a listener and this is what i have at the moment… @Override public void keyReleased(KeyEvent e){ out.println("KEY release "+e.getKeyCode()); System.out.println("Say …the mouse events but no key events. Can this be done somehow... or should i just make a separate key listener? Re: Key Logger vs Key Listener Programming Software Development by harinath_2007 Keylogger is a software which will captures all your keystrokes and activity you do on the computer. Whereas KeyListener is a interface in java which you should implement in your java code if you want to capture key strokes. Making keylogger in java is NOT possible. Re: Key Listener Programming Software Development by Slyvr …you sure you haven't added the listener more than once? Because that is kind… void keyReleased(KeyEvent r) { System.out.println("key released"); } public void keyTyped(KeyEvent t) {… System.out.println("key typed"); } } ); } } /** This is the demo… Re: Key Listener Programming Software Development by Ezzaral Are you sure you haven't added the listener more than once? Because that is kind of what your output looks like. I don't see anything wrong with your listener code itself. Re: Key Listener Programming Software Development by Slyvr …: 20 key pressed playerx: 40 key released key released key released key pressed playerx: 60 key pressed playerx: 80 key pressed playerx: 100 key released key released key released key released… Key Listener Programming Software Development by Slyvr …(); } } public void keyReleased(KeyEvent arg0) { System.out.println("key released"); } public void keyTyped(KeyEvent arg0) { System.out.println… is my console output: [QUOTE]key pressed playerx: 20 key pressed playerx: 40 key released key released key released[/QUOTE] For some reason, … Re: Key Listener Programming Software Development by kvprajapati TheParadox, Use common event handler for different components. Re: Convert mouse listener to key listener Programming Software Development by sk8er3577 … into the empty space in the direction of the corresponding key that was pressed. I believe the easiest way to do… EMPTY tile to always be the tile selected by the listener. I hope I am making more sense :) Thanks for your… Re: Convert mouse listener to key listener Programming Software Development by JamesCherrill It can't be hard to add a small `public void moveEmptyCell(int direction) ` method to your logic, and just call that from the key handler? ps On second thoughts, by the time you've coded the switch in that method, it will be shorter and clearer just to have four methods: public void moveEmptySquareUp() public void moveEmptySquareLeft() etc Re: Convert mouse listener to key listener Programming Software Development by sk8er3577 … does not result in any prints when the left arrow key is pressed Re: Two in one: Mouse and key listener. Help needed. Programming Software Development by JamesCherrill You may find that this is a problem with keyboard focus - are you sure the focus is on your JLabel? Try clicking it once then pressing a key. Re: Key Logger vs Key Listener Programming Software Development by Akill10 There is no "Keylogger" interface in Java. So the thread title does not make sense. Anyway, to add to what harinath said, You cannot make a keylogger using java. It lacks the low level operating hooks needed to do it. Re: Key Listener Programming Software Development by mKorbel majorities of Listeners works multiplayed, but just last give output to GUI, you can compare that with DocumentListener, ListSelectionListener ... [url]http://download.oracle.com/javase/tutorial/uiswing/events/index.html[/url] check this one [url]http://download.oracle.com/javase/tutorial/uiswing/misc/keybinding.html[/url] Re: Key Listener Programming Software Development by Slyvr [QUOTE=mKorbel;1524619]majorities of Listeners works multiplayed, but just last give output to GUI, you can compare that with DocumentListener, ListSelectionListener ... [url]http://download.oracle.com/javase/tutorial/uiswing/events/index.html[/url] check this one [url]http://download.oracle.com/javase/tutorial/uiswing/misc/keybinding.html[/… Re: Key Listener Programming Software Development by Ezzaral Just move the addListener() code up into the constructor. You can still call repaint() the same way. edit: You may want to consider using Swing JFrame and JPanel classes instead of Frame and Canvas unless there is a reason you need to stick to older awt classes. Re: Key Listener Programming Software Development by Slyvr [QUOTE=Ezzaral;1525479]Just move the addListener() code up into the constructor. You can still call repaint() the same way. edit: You may want to consider using Swing JFrame and JPanel classes instead of Frame and Canvas unless there is a reason you need to stick to older awt classes.[/QUOTE] Huzzah! It's working perfectly and all the code is … Re: Key event problem Programming Software Development by nocookies92 Yeah, it's showing that for some reason, my program isn't picking up on key events, even though I implemented the key Listener interface and overrode it's methods. Re: Key event problem Programming Software Development by nocookies92 What do you mean by: "are they connected to any components?" The key listener is implemented in the driver class and the extended JPanel is focusable. JOptionPane returns wrong value when pressed using Tab key Programming Software Development by poojavb … if I select the No button using the TAB key and press enter key the application still closes. Can anyone tell me… }//WindowHandler I need the button to react to the mouse listener as well as the key listener depending on the users choice Re: Suppresing a pressed key Programming Software Development by NormR1 …QUOTE]problem is when one player keeps a key pressed then the other key event does not execute[/QUOTE] Is there a…flow of events to the key listener? Are there only event coming from the pressed key until that key is released? If so,… you could restrict the time between handling key presses on a single key by requiring a minimum time between presses …