473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(in t 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 10627
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.uwat erloo.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(in t 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.uwat erloo.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(in t 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.uwat erloo.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(in t 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
22728
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 following are the problems and I hope that there is someone who can enlighten me or give me some pointers. Also, my testing code is attached at...
3
3596
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 purpose is to get the position of the mouse pointer on the bitmap. However, for some reason, the left (I also tried right) mouse clicks are not...
3
2059
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 forecolor, backcolor and font. The labels also are rotatable and the text can also be flipped 180 degrees (the flipped text part is still being worked...
22
3173
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 If statement to see if a file was already playing and if so executes some code to stop the previous file from playing among other things. There's...
5
4722
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 gets triggered and the double click is not identified at all. Is there any way I can invoke the double click when the mouse move also exists?
2
4386
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 seems a little silly. Anyone know how to circumvent this? Right now I am having the function that is bound to the double click event undo the...
1
1825
by: kezhou wang | last post by:
Could you please tell me how to create a fake MOUSE CLICK in a Table ?
19
5916
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 the page but I find that the iframes interfere with the getting the mouse coords from the screen which is essential in moving the scroll bar around....
5
574
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 left and right). When I select the form and go to the events tab (the bolt icon in properties), it gives me several options to choose from...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.