Results 1 to 3 of 3
  1. #1
    Niarbeht is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Default [Solved?] Question concerning catching keypresses for out-of-focus windows.

    So, I'm writing a simple program whose purpose is to track respawn timers on monsters in a game, specifically League of Legends. Yeah, I know, it sounds like it might not belong in the "Advanced Java" section, but what makes this particularly interesting is that I'm hoping to catch user-bindable keys (say, keys 7 through 0 on the keyboard, or perhaps f9 through f12 or similar) while the program does not have focus. The idea is that my friends and I (and perhaps more people in the future if I think the program works well enough) would be able to just hit a key to trigger the countdown timers for the monsters in the game while the game itself still has focus. To my knowledge, this cannot be achieved through the traditional ActionMap/InputMap methods.

    So, are there any ideas on how to accomplish catching key events when a window does not have focus? I've Googled around and mostly found very little helpful information. What little I have found basically states that I need to use Java's JNI (Java Native Interface).

    Anyway, thanks in advance for your consideration!
    Last edited by Niarbeht; 06-11-2011 at 01:06 AM.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

  3. #3
    Niarbeht is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Default

    I think that just might do it :O

    I'll be messing with the thread tools to see if I can set this thread to something akin to solved.

Similar Threads

  1. Question about Dialog windows and files
    By Moorag in forum New To Java
    Replies: 2
    Last Post: 03-19-2011, 01:17 AM
  2. Help with Catching Exceptions
    By javaman1 in forum New To Java
    Replies: 4
    Last Post: 09-11-2010, 02:06 AM
  3. Detect keypresses without consol or GUI
    By somanayr in forum New To Java
    Replies: 7
    Last Post: 05-16-2010, 05:56 AM
  4. get keypresses from SVGForm with only SVGLabels
    By erik6048 in forum CLDC and MIDP
    Replies: 1
    Last Post: 02-23-2010, 08:13 AM
  5. Help - Swing Timers, Two Keypresses
    By Gheta in forum AWT / Swing
    Replies: 2
    Last Post: 07-29-2009, 09:23 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •