Results 1 to 4 of 4
  1. #1
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Implementing an event listener?

    Hi,
    I have a simple frame with an object that i would like to move around. How can i implement an event listener to react to key presses.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,899
    Rep Power
    25

    Default

    There is the KeyListener interface and there is Key binding.
    Key binding is a bit longer to code but less prone to problems with focus.

  3. #3
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default

    Yes, that is what i was thinking i just cant get my head around using it though.

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,899
    Rep Power
    25

Similar Threads

  1. GIOVYNET Java Serial Comm event listener
    By Edudlc in forum New To Java
    Replies: 5
    Last Post: 05-17-2011, 03:38 PM
  2. how to add event Listener to Image
    By shane5317 in forum Java 2D
    Replies: 3
    Last Post: 03-13-2011, 12:36 PM
  3. JColorChooser modeless - Event Listener problem
    By siamino in forum New To Java
    Replies: 1
    Last Post: 04-14-2009, 01:39 AM
  4. checking for an event during an event
    By infinity in forum AWT / Swing
    Replies: 22
    Last Post: 04-09-2009, 02:08 AM
  5. Listener for SWT event
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-08-2008, 10:04 AM

Posting Permissions

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