A fake mouse click

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nik Belyaev

    #1

    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
  • Benoit Peltier

    #2
    Re: A fake mouse click

    Have you tried the java.awt.Robot class ? It seems to have the method you
    need.

    Benoit



    "Nik Belyaev" <enby2005@gmail .com> wrote in message
    news:drnmk3$pvi $1@rumours.uwat erloo.ca...[color=blue]
    > 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[/color]


    Comment

    • Ian Shef

      #3
      Re: A fake mouse click

      Nik Belyaev <enby2005@gmail .com> wrote in
      news:drnmk3$pvi $1@rumours.uwat erloo.ca:

      <snip>[color=blue]
      > 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.[/color]
      <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 *

      Comment

      • Nik Belyaev

        #4
        Re: A fake mouse click

        On Tuesday 31 January 2006 14:09 Ian Shef wrote:
        [color=blue]
        > Nik Belyaev <enby2005@gmail .com> wrote in
        > news:drnmk3$pvi $1@rumours.uwat erloo.ca:
        >
        > <snip>[color=green]
        >> 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.[/color]
        > <snip>
        > Take a look at java.awt.Robot, available since Java 1.3.
        > Methods available include mouseMove, mousePress, and mouseRelease.
        >
        >[/color]

        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

        Comment

        Working...