J2ME, Robot class, and sending mouse clicks from a remote device

I'm trying to simulate a mouse click on a client machine, using J2ME on a remote host device. What's the best way to do this?

import java.awt.Robot;
import java.awt.event.InputEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Main
    public static void main(String[] args)
        JFrame frame = new JFrame();
        frame.getContentPane().add(new JButton("Click Me"));
        frame.pack();
        frame.setLocationRelativeTo(null);
        try
            // Simulate a middle-button mouse click
            Robot robot = new Robot();
            robot.mousePress(InputEvent.BUTTON2_MASK);
            // Simulate a middle-button mouse click again
            robot.mousePress(InputEvent.BUTTON2_MASK);
        catch (Exception e)
            e.printStackTrace();
        frame.setVisible(true);
}?

Similar Messages

  • Robot class and obtaining mouse position

    The Robot class has the mouseMove(int x, int y) method which allows you to position the mouse at the given x-y coordinates. I am trying to move the mouse using relative coordinates, i.e. move 200 pixels left, as opposed to moving to 400,800. Is there a way to obtain my cursor's current position? I've looked at the MouseEvent class, and I'm not very sure that would work, as it requires input from the mouse in order to trigger.

    TryPointerInfo pointerInfo = MouseInfo.getPointerInfo();
    Point p = pointerInfo.getLocation();

  • Robot class and keystrokes

    Can somebody help me? I have a 14000 plus line coded program. I need to generate software produced keystrokes. For example I would like to have my program hit the 'Enter' key instead of it being generated from the keyboard by a user. Now, I have just briefly been introduced to the Robot class and I am trying to understand it. I guess to use it I have to throw a AWTException. The problem is where I need to use the Robot class is in a JButton ActionListener(), which is on line 8000 nested in another frame. My question is how and where do I throw the AWTException in my program so that I can use the Robot class to generate an 'Enter' keystroke? I have noticed that in some sample programs the AWTException follows the opening
    public static void main(String[] args) throws AWTException
    statement. I tried attaching this in my program but the code nested in a AcitionListener did not recognize it.
    What I am hoping is that I can throw the exception in the following format:
    try
    Robot robot = new Robot();
    robot.keypressed(VK_ENTER);
    catch (AWTException exception)
    exception.printStackTrace();
    This is just a format I made up to show what I am looking for it has no actual copyright.
    I do not want to throw the AWTExecption for my whole program just this localized area when I need to have the software hit enter for me.
    Anyway, this is my problem can you help me out
    Derek.

    I just figured the problem out myself, by just guessing believe it or not.
    As follows :
    try
    Robot rob = new Robot():
    rob.keyPressed(VK_ENTER);
    catch(AWTException exception)
    exception.printStackTrace();
    It worked perfectly.

  • Subject and sender is copied from prevous email on some emails

    Hi
    On some emails the Subject and Sender name is from another email received at the same time. This is totally random, does not happen all the time. I have included screenshots from two emails of the most recent recevied email with this error.
    We have 4 computers and we all have the same IMAP account on every computer but this happens randomly on the computers. One may receive the cloned subject and sender while the others will not. This has happened randomly on all 4 computers. When checking on the web-mail they all appeare correctly.
    /Petri

    Sounds like this might be an indexing issue.
    right click on folder and select 'Properties'.
    click on 'REpair folder'
    Click on OK
    Refresh the Folder Pane by selecting another folder and then reselecting the repaired folder

  • When I try and send a link from mail it says I must re-install my OS in my 2012 Mac Air

    when I try and send a link from mail it says I must re-install my OS in my 2012 Mac Air

    Typing in additional text seems to get the job done.  This seems to be a feature of the latest IOS update, I have never had the problem before the last update.
    I use the box with the arrow just to the left of the URL block at the top of the page to send myself links to pages of interest.  Adding the extra text seems like a pointless step, but it does work.
    Thanks.

  • I am having problems with my outlook 2011. While i am able to check and SEND email on all my other devices ( Ipad, iphone, Macbook), I am unable to do so with my iMac. This problem started suddenly and the error message i get is error 5.7.8. Please Help

    I  am having problems with my outlook 2011. While i am able to check and SEND email on all my other devices ( Ipad, iphone, Macbook), I am unablesend any email with my iMac ( i can recieve email) . This problem started suddenly and the error message i get is error 5.7.8. I have read the threads on line and went into settings, even created a new profile, nothing helps...Please advice..is this something to do with my keychain Access?

    As Outlook is not an Apple product, you will find more helpers familiar with Outlook here:
    Office for Mac forums

  • Robot class and positioning the cursor

    I have an application where I have a number of panels on the screen and using an editable field wish to enter coordinates to position the Cursor to on another panel.
    ie, using grid coordinates on a map. Using the robot class I am able to position the cursor on the other panel but as soon as I move the mouse the cursor jumps back to the original position on the screen where the first panel with the editable field was. It is like only a picture of the cursor was drawn at the new coordinates and the real cursor is still at the old podition. It is important to this application that if the cursor is moved it stays where it has been moved to and actually is there and not just appearing to be there. I am using jdk 1.3 on Intel Solaris 2.8. Any help on this issue would be helpful and appreciated

    Maybe you can use the mouse move event to position the mouse to where you had moved the cursor to.
    for example
    1.the mouse is at point 100,100
    2. you move the cursor from your code to point 0,0
    3. the user starts to move the mouse
    4. you code gets that event and repositions the cursor to the last place where it was, that is at 0,0

  • Diable "open dialog box" on right mouse click so I can use l mouse to advance to next slide and r mouse click to "go back."  How in PP 2010 for mac????

    I do presentations in PP10.  I am new to macair, and used to Windows.  HOW DO I DISABLE THE "OPEN DIALOG BOX ON RIGHT CLICK"?  I would like to use L mouse to advance slide, and R mouse to go back.  The default is to use R mouse to open dialog box.  I can disable this by unchecking the box in "advanced" on the PC.  How do I do it with the Mac????
    Thanks
    hacmd

    Hi Rod,
    As originally stated in my opening post, the SWF is to be inserted into an Articulate '13 slide (what I called an aggregator originally - I tried not to bring them up since I don't want the chatter about "There's your problem - using Articulate"! ).
    Recall that posting this published file to our LMS did not allow right-mouse click functionality as the flash player menu just gets in the way.
    If I insert the captivate 6 files into Articulate as a Web Object (referencing the entire folder with html, htm and assets, and then posted to our LMS, and it DOES allow RM click operations in both IE and FF (although no sound on the Captivate slide in FF). But this is not what we want to do as this introduces 2 navigation controls (the Captivate one and the Articulate Player).
    Why must anything be posted to a web server for this functionality to work?
    I am able to go into the Captivate 6's published folder, and launch the Captivate demonstration by simply double clicking on the index.html file and this works great in both FF and IE after changing the security settings for flash.
    Again - I can not believe I am the only one out there trying to use the right-mouse click feature to do a software simulation by embedding the Captivate SWF into an Articulate '13 project.

  • How to zip report output and send via mail from application

    Hello,
    I want to know how to zip the report output and send it by mail to concerned person from application
    I want this as the report is having more than 70000s of records.
    Also the XLS has the limitation of 2^16 records and the report is having more than this
    Any help is very much appreciated
    Regards,
    Vani

    1: Make a Dummy report. From some post parameter form trigger, run your original report with "srw.runreport" call. The original report can generate output to a file.
    2: Then withing this dummy report run, call a user exit to zip the
    original reports output. You need to write this user exit and attach them
    with reports.
    3: Now use Report 9i distribution for this dummy report to sent this external zip file through mail.
    With Regards
    Reports Team

  • ParameterFieldController class and getDataDefController() method missing from com.crystaldecisions.reports.sdk.*

    I am trying to use the desktop samples for the JRC. The parameter setting sample will not compile because the ParameterFieldController class and the ReportClientDocument's getDataDefController() method are missing from com.crystaldecisions.reports.sdk.* .
    I have release 2 of Crystal Reports XI Developer and should have the most up to date jrcerom.jar file for that product. What is it going to take to get this working? This is a critical aspect of using Crystal Reports for our java application reporting needs.
    Prompt attention to this is appreciated.

    <p> </p><p>That class is not in that package, but another package imported in the sample, and in a different jar file. </p><p>The readme file should reference a deployment guide listing the required jar files, which I&#39;ve copied here:</p><p> <a href="http://support.businessobjects.com/communityCS/TechnicalPapers/cr_xi_r2_jrc_deployment.pdf" target="_blank">http://support.businessobjects.com/communityCS/TechnicalPapers/cr_xi_r2_jrc_deployment.pdf</a></p><p>Sincerely,</p><p>Ted Ueda </p>

  • Can't select and send several emails from outlook to onenote

    I have been successfully using the Send to Onenote button from Outlook when choosing either one email or numerous emails.  However, starting last week, I can no longer choose more than one email and send it to Onenote.  I can choose several emails
    and use the Print To Onenote option, but then all emails are put into a single page in Onenote.  
    I can choose a single email at a time and send that to OneNote with no problem.
    I am running Windows 7 with Service Pack 1, 64 Bit
    Outlook and Onenote are Office Professional Plus 2010 32-bit
    Has anyone else experienced this?  
    Thanks

    The latest fix is in thread "http://answers.microsoft.com/en-us/office/forum/office_2010-outlook/cant-send-multiple-emails-to-onenote/52f276db-5826-49f3-93b5-45f9b5a9e4f7?page=2&rtAction=1386601168018"
    When I removed both KB2794707 and KB2837597 the problem with multiple email send to onenote went away again.  I wish they listed the authors on those fixes.  There may be a code fragment causing this that they keep inserting into newer fixes and
    it would be nice if that would stop.

  • Re I-Movie.  "Communication Error" is what I get when I try and send a clip from my Sony camera to the IMovie program in my IMAC 2008 Intel Chips.  The IMovie program has worked well for several years - up to now.  What has gone wrong?

    Re I-MOVIE.  I am getting a "Communication Error" when I try and send a clip to the IMovie
    program in my IMAC 2008 Intel Chip computer.  This is the first time in 3 years that the
    program has not worked.  What has gone wrong?

    Hi
    Have no idea - But if it is a new problem with exactly the same kind of material that was previously used. Then my trouble shooting guide might help.
    If You
    • used a new Camera - file codec might be a sort that don't work
    • Your main hard disk might get too filled up
    Else try
    Trouble
    When iMovie doesn't work as intended this can be due to a lot of reasons
    • iMovie Pref files got corrupted - trash it/they and iMovie makes new and error free one's
    • Creating a new User-Account and log into this - forces iMovie to create all pref. files new and error free
    • Event or Project got corrupted - try to make a copy and repair
    • a codec is used that doesn't work
    • problem in iMovie Cache folder - trash Cache.mov and Cache.plist
    • version miss match of QuickTime Player / iMovie / iDVD
    • preferences are wrong - Repair Preferences
    • other hard disk problem - Repair Hard Disk (Disk Util tool - but start Mac from ext HD or DVD)
    • External hard disks - MUST BE - Mac OS Extended (hfs) formatted to work with Video
    ( UNIX/DOS/FAT32/Mac OS Exchange - works for most other things - but not for Video )
    • USB-flash-memories do not work
    • Net-work connected hard disks - do not work
    • iPhoto Library got problems - let iPhoto select another one or repair it. Re-build this first then try to re-start iMovie.
    This You do by
    _ close iPhoto
    _ on start up of iPhoto - Keep {cmd and alt-keys down}
    _ now select all five options presented
    _ WAIT a long long time
    • free space on Start-Up (Mac OS) hard disk to low (<1Gb) - I never go under 25Gb free space for SD-Video (4-5 times more for HD)
    • external devices interferes - turn off Mac - disconnect all of them and - Start up again and re-try
    • GarageBand fix - start GB - play a few notes - Close it again and now try iMovie
    • Screen must be set to million-colors
    • Third-party plug-ins doesn't work OK
    • Run "Cache Out X", clear out all caches and restarts the Mac
    • Let Your Mac be turned on during one night. At about midnight there is a set of maintenance programs that runs and tidying up. This might help
    • Turn off Your Mac - and disconnect Mains - for about 20-30 minutes - at least this resets the FireWire port.
    • In QuickTime - DivX, 3ivx codec, Flip4Mac, Perian etc - might be problematic - temporarily move them out and re-try
    (I deleted the file "3ivxVideoCodec.component" located in Mac HD/Library/Quicktime and this resolved my issue.)
    buenrodri wrote
    I solved the problem by removing the file: 3ivxVideoCodec.component. after that, up-dated iMovie runs ok.
    Last resort: Trash all of iMovie and re-install it
    Yours Bengt W

  • Simulate any mouse click from webview

    How can I simulate any mouse click on any element of the site in webview ? (I have not managed yet to jquery and javascript control 100% of cases)

    http://forum.java.sun.com/thread.jsp?forum=4&thread=191468
    http://forum.java.sun.com/thread.jsp?forum=5&thread=135141
    http://forum.java.sun.com/thread.jsp?forum=54&thread=202069
    http://forum.java.sun.com/thread.jsp?forum=5&thread=11443
    this are some results of search applet browser +close                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Distinguish left and right mouse click

    I am making some demo, I don't use any narration. How do I
    tell the viewer when to use left mouse click and when to use right
    mouse click? Can it be done automatically?

    Hello Simon,
    Hmmm, I don't think that there is anything in Captivate that
    will automatically let the leaner know that you are
    right-clicking...Here are some of the things that I might try.
    1. Adding a text caption that notifies the learner that I am
    right-clicking
    2. At the very start of the demonstration point out to
    learners that when they hear a certain sound this is an indication
    that I am right-clicking.
    3. Create a small animation that shows pressing the right
    mouse button
    4. Use one of the existing animations that you can find in
    the Adobe Captivate 2 gallery such as visual clicks and again point
    out at the beginning of the demo that when they see this animation
    you are performing a right-click action, you could also record or
    import audio onto your animation if you so desired.
    Those are my (of the top of my head) thoughts . I am sure
    that there are others.
    Regards,
    Mark

  • Running bootcamp and right mouse click on windows

    Hi all, I was just looking to setup WinXP on my machine and wanted to know how my macbook pro laptop mouse would deal with the right mouse click on windows? If I dont have an external mouse plugged into the laptop is there no right mouse click available?
    Thanks!

    Download a program called AppleMouse at http://www.softpedia.com/get/Desktop-Enhancements/Other-Desktop-Enhancements/App le-Mouse-Utility.shtml. Unzip it the copy-and-paste "applemou.exe" to this directory through Windows Explorer: C:\Documents and Settings\YOUR USER NAME\Start Menu\Programs\Startup. Once copied, restart your computer back into Windows and login. You'll be able to right-click by holding down the control (ctrl) button and clicking.
    MacBook Pro 17" 2.16GHz, 120GB, 2GB, Matte, 120GB USB Western Digital HDD   Mac OS X (10.4.6)   Windows XP Dual-Boot, Toasting Over 189.6 degrees Fahrenheit in CoreDuoTemp

Maybe you are looking for

  • JMF-based applet can not detect audio devices on Vista (?)

    Hi, As many people reported, I encountered the same issue - CaptureDeviceManager.getDeviceList does not detect any audio device on IE/Vista. Here is my testing environment: HP XW4600, RealTek HD Audio onboard sound card, Vista SP1 (Business, Home Pre

  • Vendor ID and Textbook Authorization

    Today I had my computer re-imaged and now I am unable to authorize my computer for my etext. When trying to log in with the account used to purchase the etext a message pops up stating, "The vendor account you entered is not associated with the item

  • On rollover make image alpha 100%

    how would I do that. I have a button that when someone rolls over it, i want an image to become visable. mybutton.onRollOver = function() { is what I have, i dont know actionscript very well. Flash 8 pro thanks

  • Information required about ESS MSS forms

    Please let me know following points:- 1.As per my understanding HCM Processes and Forms ( Hiring, Transfer ,Maternity leave ,Termination ) needs Hr administrator Role it  not present in portal box so please let me know if we need it?. 2.It belongs to

  • Can you re-set up id apple on the iphone?

    Hi There My wife mixed up her apple ID. The thing is that the apple ID she typed a wrong one in the  icloud settings of her new iphone. Problem is that her iphone cannot use icloud and there is no way to change to the right one because she does not k