Results 1 to 2 of 2
  1. #1
    Crystaliss is offline Member
    Join Date
    Nov 2008
    Rep Power

    Default Java program help

    I have checked some tutorials around the web and i need some help on how to do some things not in any of the tutorials that i found.

    #1: how to store mouse x and y values into variables.
    #2: how to tell what button on the mouse is being pressed.
    #3: how to check for #2 every second.(what i mean by this is that when i tried using delay but it doesnt know im clicking on mouse buttons if im doing so during delay time.)
    #4: same as #2 and #3 but for keyboard.

    I am currently trying to make a program that records mouse/keyboard actions, I just need to know how to do these things, also, if there is any additional info that might be needed for these

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Houston, TX & Flint, MI
    Rep Power


    You seriously can't find this online when you search? I came across this on every link dealing with a mouseListener.

    1-3 can all be done by adding a mouseListener. Look up MouseAdapter and MouseEvent.
    1: Getting x and y is as easy as event.x,event.y
    2: event.button gets assigned a value(1-n)where n is the number of buttons on your mouse
    3: this is done automatically when you attach the listener to your object.

    4: Havn't tried anything with keyboard but it's probably really similar just with KeyboardListener or something

Similar Threads

  1. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  2. New to Java Program
    By jvasilj1 in forum New To Java
    Replies: 1
    Last Post: 02-05-2008, 07:22 AM
  3. Replies: 0
    Last Post: 10-04-2007, 09:33 PM
  4. help with java program
    By mattvgt in forum New To Java
    Replies: 3
    Last Post: 07-14-2007, 04:57 PM
  5. java program
    By nehasahu in forum New To Java
    Replies: 5
    Last Post: 07-12-2007, 11:05 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