Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JAVA pressing buttons through application

Options
  • 20-02-2006 1:33pm
    #1
    Closed Accounts Posts: 27


    Im using a java application to press buttons on the keyboard. Like if you click a button on the application it presses Ctrl P on the keyboard. Can anybody give me any help with this


Comments

  • Closed Accounts Posts: 3,285 ✭✭✭Smellyirishman


    Em, your probably going to have to come up with more than that; what exactly have you tried, what approach are you considering, where are you getting stuck etc....


  • Closed Accounts Posts: 27 Lint


    i havn't tried anything... what im trying to develop is an application that allows you to perform keystrokes by clicking an icon


  • Registered Users Posts: 1,610 ✭✭✭dbnavan


    at last a java question I answer not ask....u need to look up keyboard mnemonics for java. loadsx of stuff online, dont have time right now to go into but thats will put u on the right path


  • Closed Accounts Posts: 27 Lint


    ah thats brilliant thanks very much., Another option I have to do it is to use keyboard macros. i'll check out that tho thanks again


  • Registered Users Posts: 1,610 ✭✭✭dbnavan


    Glad to have helped, just learning java myself too.


  • Advertisement
  • Registered Users Posts: 4,188 ✭✭✭pH


    If you want to send keystrokes within a java gui have a look at java.awt.Robot
    - keyPress(key)
    - keyRelease(key)


  • Closed Accounts Posts: 27 Lint


    I got that keyPress working but the thing is now that my application sits on top of media player. and keyboard shortcuts only work for whatever is on the screen at the time. so im gonna have to figure that out now


  • Registered Users Posts: 1,610 ✭✭✭dbnavan


    Lint wrote:
    I got that keyPress working but the thing is now that my application sits on top of media player. and keyboard shortcuts only work for whatever is on the screen at the time. so im gonna have to figure that out now

    Could be wrong but think you'll have a problem there, keyboard short cuts only apply to the 'active application' like trying to press ctrl+P to print a word document when media player is active application, wont work. May be a work around but i highly doubt it.


  • Registered Users Posts: 885 ✭✭✭clearz


    If you are using Windows and you dont mind using JNI you could get a handle to any window using FindWindow and pass messages to it that way.


Advertisement