473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

A fake mouse click

Hi, All!

I've come across a problem which I've never met before. My program has to
emulate a mouse movement and a mouse click. I.e. I need something like
"mouseMoveTo(int x, y)" and "mouseClick()" that moves the cursor at (x,y)
of the screen and emulates a left click, respectively.

I tried searching for this kind of method in the RTFM but I didn't get any
results...

I'd really appreciate if someone could show me the right way of implementing
this.

PS If it makes it different, the system is Linux with KDE 3.4

--
With best regards,
Nik
Jan 31 '06 #1
3 10622
Have you tried the java.awt.Robot class ? It seems to have the method you
need.

Benoit

"Nik Belyaev" <en******@gmail.com> wrote in message
news:dr**********@rumours.uwaterloo.ca...
Hi, All!

I've come across a problem which I've never met before. My program has to
emulate a mouse movement and a mouse click. I.e. I need something like
"mouseMoveTo(int x, y)" and "mouseClick()" that moves the cursor at (x,y)
of the screen and emulates a left click, respectively.

I tried searching for this kind of method in the RTFM but I didn't get any
results...

I'd really appreciate if someone could show me the right way of
implementing
this.

PS If it makes it different, the system is Linux with KDE 3.4

--
With best regards,
Nik

Jan 31 '06 #2
Nik Belyaev <en******@gmail.com> wrote in
news:dr**********@rumours.uwaterloo.ca:

<snip>
I've come across a problem which I've never met before. My program has
to emulate a mouse movement and a mouse click. I.e. I need something
like "mouseMoveTo(int x, y)" and "mouseClick()" that moves the cursor at
(x,y) of the screen and emulates a left click, respectively.

<snip>
Take a look at java.awt.Robot, available since Java 1.3.
Methods available include mouseMove, mousePress, and mouseRelease.
--
Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *
Jan 31 '06 #3
On Tuesday 31 January 2006 14:09 Ian Shef wrote:
Nik Belyaev <en******@gmail.com> wrote in
news:dr**********@rumours.uwaterloo.ca:

<snip>
I've come across a problem which I've never met before. My program has
to emulate a mouse movement and a mouse click. I.e. I need something
like "mouseMoveTo(int x, y)" and "mouseClick()" that moves the cursor at
(x,y) of the screen and emulates a left click, respectively.

<snip>
Take a look at java.awt.Robot, available since Java 1.3.
Methods available include mouseMove, mousePress, and mouseRelease.


OK, Thanks everybody! This is exactly the kind of class I've been looking
for but somehow couldn't find ;). Thanks again...

--
With best regards,
Nik
Jan 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The...
3
by: mitsura | last post by:
Hi, I have included a small listing. The test program opens a panel and show a bitmap. What I want is to when the mouse is over the bitmap panel, I want to trap the left mouse click. The...
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
22
by: Ricky W. Hunt | last post by:
First, the subject probably doesn't use the correct terms but I'm not sure what it's called in VB. I'm writing a media player app. The subroutine that handles the "open file" button contains an...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
2
by: scott_gui | last post by:
I am creating a Windows application: The mouse event <Double-Button-1> has a conflict when the <Button-1> event also has a binding. Double clicks will first perform the single click action. This...
1
by: kezhou wang | last post by:
Could you please tell me how to create a fake MOUSE CLICK in a Table ?
19
by: wmanzo | last post by:
I have a really professional conspiracy movie site and I use tons of layers and an external scroll bar assembly. I would like to put the various sections into MS Iframes and in order to clean up...
5
by: Adeel | last post by:
Hi group! I'm trying to learn C# on my own... I'd appreciate it very much if someone can help me out here. I have a basic form without any controls on it... I want to catch mouse clicks (both...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.