Results 1 to 2 of 2
Thread: Java program help
- 11-20-2008, 05:14 AM #1Member
- Join Date
- Nov 2008
- Rep Power
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
- 11-20-2008, 04:46 PM #2
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
- By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 03:40 PM
- By jvasilj1 in forum New To JavaReplies: 1Last Post: 02-05-2008, 08:22 AM
- By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 10:33 PM
- By mattvgt in forum New To JavaReplies: 3Last Post: 07-14-2007, 05:57 PM
- By nehasahu in forum New To JavaReplies: 5Last Post: 07-12-2007, 12:05 PM