Absolute coordinates using DefaultKeyboardFocusManager

I want to rerun events through Robot to recreate a user's actions. I created my own version of DefaultKeyboardFocusManager to print all events to a file. When I looked at the file I realized that all of the mouse-move coordinates were relative, not absolute, i.e. they are in reference to every widget the mouse happens to lie over. The application I need to test is large and all widgets (JPanels, et al) are not named, so I cannot reference them by name (if all widgets were named, I could keep track of relative positioning as the mouse enters each new widget). Is there a way to generate absolute coordinates instead of relative coordinates? The easiest solution would be a method to toggle between relative and absolute coordinates, but that does not appear to exist.

not that i agree with your methods but there is a Component method called
getLocationOnScreen(). also, im fairly sure there is a method to translate a relative component
location to a location relative to its parent, but im embarrassed to say i forgot what
its called.
but of course thats exactly why this sort of question should be posted in the Swing forum instead...

Similar Messages

  • Setting absolute coordinates of a JLabel

    Is it possible to set absolute (x,y) coordinates using JLabel? Thanks a bunch!

    way112 wrote:
    Is it possible to set absolute (x,y) coordinates using JLabel? Thanks a bunch!Or using setBounds(....) method but I would recommend using a proper layout
    so that you won't have a hard time setting the components.

  • How to make a robot roam and simultaneously display its coordinate using other vi

    Hi i am using Cricket to find the coordinates of moving robot as my receiver is attached to the robot.I made a vi which can extract the exact coordinates using my CRICKET sensor data.How to move a robot and simultaneously display its coordinates.In turn moving the robot usin roaming Vi as well as same time my VI display its coordinate.

    Hi,
    Is this an NXT robot and are you deploying your code on the robot?  Are you running the robot from a VI on you PC using blue tooth, etc... ?
    If you are running both VI's in LabVIEW you can use parallel loops.  If they have to communicate with each other, then you have to decide which approach to use with parallel loop communication.  Like simple variables or more complex choices like queue, etc...
    Can you provide more information about your system and version of LabVIEW?
    Mark Ramsdale

  • How to get Absolute Coordinates of a Field.

    I know that the properties "x" and "y" of any field of PDF Form will give me the coordinates relative to the parent object.
    How to get the absolute coordinates of any object (or any field) on a PDF Form?
    My objective is to make a Subform Visible or Hidden and reposition it close to any other field in order to display some extra text to show more info about the required field.
    How I can do that?
    Tarek.

    Hi,
    I wrote a recursive function that will go up in the forms hierarchy and summarizes the x and y coordinates of the parent objects.
    var vX = 0
    var vY = 0;
    function findCoordinates(vNode) {
        if (vNode !== null) {
            if (vNode.className === "field" || vNode.className === "subform") {
                console.println(vNode.name + " > " + vNode.x);
                var xUnit = vNode.x.match(/(mm|cm|pt|in)/g);
                var xValue = parseFloat(vNode.x.replace(xUnit, ""));
                if (xUnit === "mm") {
                    vX += xValue / parseFloat("25.4");
                } else if (xUnit === "cm") {
                    vX += xValue / parseFloat("2.54");
                } else if (xUnit === "pt") {
                    vX += xValue / 72;
                } else {
                    vX += xValue;
                var yUnit = vNode.y.match(/(mm|cm|pt|in)/g);
                var yValue = parseFloat(vNode.y.replace(yUnit, ""));
                if (yUnit === "mm") {
                    vY += yValue / parseFloat("25.4");
                } else if (yUnit === "cm") {
                    vY += yValue / parseFloat("2.54");
                } else if (yUnit === "pt") {
                    vY += yValue / 72;
                } else {
                    vY += yValue;
            findCoordinates(vNode.parent);
        var vCoordinates = (Math.round(vX * 2) / 2) + "mm " + (Math.round(vY * 2) / 2) + "mm";
        return vCoordinates;
    Textfeld2.rawValue = findCoordinates(xfa.resolveNode("Teilformular1.Teilformular2.Textfeld1"));

  • Using absolute coordinates with JButton

    I have a project that uses the JDesktop, JInternalFrame, JPanel. I am able to place JButtons on the JPanel but I am unable to use the setLayout(null) and setLocation( literalx, literaly) to position buttons where I want.
    Can someone give me a simple example of how to do this?
    Ulimately I want to be able to create an event that allows me to click on the button and drag it to another x and y coordinate as part of a simple layout designing tool.

    [url http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html]Absolute Positioning

  • How can I display current iPhone GPS coordinates using compass app

    How can I display current iPhone GPS coordinates, when traveling overseas with no access of data or wifi
    using "iphone compass app"(Both the latitude and longitude) ??
    if iphone compass app require any sort of data
    what alternative would there be? (to document the coordinates)?

    Hi
    Iphone 5s 16 gb 8.1
    My fone freeze whenever i charge my fone its appear white screen with apple logo.. and as soon as i try to press hold home and power button
    it shows battery drained sign>> i m facing this problem from last one week
    and itunes also not  getting cconnected
    can any1 please help me out
    sorry for poor english

  • Absolute navigation using post parameters

    Hi All
    I am navigating from WD4A iview to WD4J iview through absolute navigation and passing some parameters.
    I am expecting that these parameters size might be large. Is there is any restriction on the size of the parameters that i can pass in these method.Can i use postparameters to  overcome this restriction on size. If i use postparameters is there any restrictions on that.
    Can someone please post some helpful info or code examples to work with post parameters (Retrieving the parameters in the receiving application). Is other any other work around apart from these options.
    Thanks,
    Karthik.

    Hi,
    Check the following Threads related with retrieval of Post parameters in WD:
    How to send data from Web dynpro App to JSP or vice versa
    Re: jsp and web dynpro
    Siddharth

  • Absolute coordinates of Component inside a Grid Parent

    I have a TextInput component inside a Grid component and it
    inside another component...
    How can i know the TextInput absolute x,y coordinates?
    <mx:TabNavigator ......>
    <mx:Canvas ...>
    <mx:Grid ...>
    <mx:GridRow>
    <mx:GridItem>
    <mx:TextInput id="AAA" />
    Thanks in advance

    My bad. I should have tried it before giving you an answer.
    This works nicely:
    <mx:TabNavigator ... />
    <mx:Canvas ... />
    <mx:Grid ... />
    <mx:GridItem>
    <mx:TextInput rollOver="showInfo(event)"
    rollOut="hideInfo()" />
    <mx:GridItem>
    </mx:Grid>
    </mx:Canvas>
    </mx:TabNavigator>
    import mx.managers.PopUpManager;
    private function showInfo( event:flash.events.MouseEvent ) :
    void
    var p:Point = new Point(event.target.x, event.target.y);
    var pt:DisplayObject = DisplayObject(event.target);
    p = pt.localToGlobal(p);
    tip = PopUpManager.createPopUp( this, <<your class
    here>>, false ) as <<your class here>>;
    tip.move( p.x+pt.width+5, p.y );
    When the mouse rolls over the TextInput (or whatever control
    you want), showInfo is called. The showInfo function converts the
    position of the TextInput (that's event.target) to global
    coordinates. Then the pop-up is created and moved into position,
    just to the right of the TextInput.
    I have working code if you want it.

  • I have absolutely no use for "Events" in iPhoto: can I get rid of this concept? I am importing photos maybe one or a dozen times a day and cannot avoid creating a new event each time. Or can I?

    As my long question implies (sorry, should have kept it shorter) I have a problem with being forced to have Events in my iPhoto'11 9.2.3 (629.52) on my MacBook 10.6.8. My habit is to unload the camera constantly, whether I have taken a single shot or a whole series. Each new addition creates an Event which actually bothers me!
    Is there a way of avoiding this? If I erase an event from iPhoto the photos will disappear from the Library it seems ... Please help with your advice. Thanks! Sigrid.

    Thanks, OT!
    When I look at my odd(?) habits of dealing with iPhoto anyone will see that I have a very simplistic approach: I never let one single Library get bigger than 300 or 400 photos, then back it up as is and make a separate, manual backup of the different albums as named by myself on an external HD. Then I delete the Library as such from my Mac but can reinstate it from the backups as I please. The backups are properly labelled, of course.
    I get dizzy when I read about libraries of thousands of photos, of keywords, ratings, smart albums etc. because this just wouldn't apply to my so-called system. So instead of using Faces and Places, my album names show clearly what's in them - "skies and scenery" Euskadi, "bugs and birds at Fancourt", "inventories", "people" (separate for my circle of people and characters from media), "my dog" etc., usually a bunch of 20 albums or so depending on my whereabouts. Quite manageable!
    I've been doing just fine with this method and would recommend it ... but others are much brighter ;-) and use the offered (and to me too advanced) features of iPhoto, if they prefer these. Now that I know how to get rid of Events by merging them into one, I at least feel a little freer there.
    Well, it's 1:25AM my time, gotta go ...

  • Doing absolute move using center reference point

    I want to place a large number of images of varying aspect ratio using the center reference point at the same point in each page.  I have played with move and it appears to always use the top left point.  My interpretation of the documentation suggests that I would get the same results with transform.
    I realize that I could do the calculations to do the move but am hoping I am missing something and there is a much simpler way to do it.
    Thanks in advance
    Jerry

    csm_phil: Your English is quite confusing. Please remember to end sentences with periods. I assume you meant to say:
    I don't know why you wrote  "Bad for performance, bad for idempotency, and bad philosophically" when this method is working.  If its working, what is the problem? Can you please explain.
    (I'm still not sure what you meant by "i want to change the your mehtods.")
    Because something is working does not mean it is right.
    Because something is working does not mean it is good.
    It may cause problems in the future. Or it may have side effects.
    I wrote four things:
    Using the selection is a bad idea. This is well-accepted by experienced scripters. Scripts should avoid using the selection wherever possible. But why? I tried to explain in brief:
    Bad for performance: Interacting with the selection is slower. InDesign has to deal with updating the display and the UI when the selection is involved, when it would not otherwise have to do so. Anytime you interact with the selection your script will be slower. That slowness may not matter most of the time, such as when you are donly doing something once.
    Bad for idempotency: When you change the selection, it becomes difficult to repeat your work, and you do not leave the state of the program as you found it. If something else is depending on the selection, then you will screw that up. It is like changing a global variable. The best solution is not to change it, but to use a local variable instead. As a workaround, you can save the old value of the selection, perform your work, and then restore the selection. But that is imperfect. What if your code is running in an event handler? What if two pieces of code that use the selection are running in parallel? What if there are thread concurrency issue? Probably not the case in CS5.5, but what about CS7?
    Bad philosophically: This one is harder to explain. I think it really boils down to, if your script is not affecting the user interface, it should not alter portions of the user interface. The selection should be considered out-of-bounds for most scripts. This is really a restatement of the previous claims, especially "bad idea," so maybe it does not count on its own. But I repeat it because it is worth repeating.
    If you're really careful, using the selection can work. But much of the time it causes problems, either in the present or in the future. It is good to avoid problems where feasible.
    I hope this post helps you to understand what I meant.

  • Setting _xy coordinates using loadMovieNum() 

    Hello,
    I need some assistance with the following problem.
    I have a number of SWF files that can be loaded in response
    to the pressing of a specific button in a dynamic menu structure.
    This menu structure works ok. However when the movie displays it is
    positioned at 0,0 with the result that the display is partially
    obscured by the menu template. The code I have attempted to use to
    rectify this problem is:
    loadMovieNum(_level0.path+_level0.movieLoad+".swf", 20);
    _level20._y = 36;
    _level20._x = 16;
    The SWF files were created using Captivate and I have found
    that by converting them to FLA files it is possible to resolve this
    problem by updating the _y axis directly and re-publishing. However
    the importing of these files into Flash8, though successful, has
    resulted in the loss of certain features and a degradation in the
    quality of the movies. Therefore I would like to avoid having to
    resort to this solution if at all possible.
    I am new to flash8 and would be very grateful for any advice
    on this problem.
    Regards,
    Westcountryphile.

    Hello,
    Thanks for the advice.
    I have attempted to resolve the problem previously described
    using MovieClipLoader class but without success as the movie
    refuses to play.
    The code I have used is as follows:
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip(_level0.path+_level0.movieLoad+".swf",
    20);
    function onLoadComplete(mcLoader) {
    _level20._y = 36;
    _level20._x = 16;
    The above code was devised from the example given in F1 Help.
    Any advice on what the correct syntax should be?
    Regards,
    westcountryphile

  • I am running Win7 64 bit on a Sony Vaio laptop and recently updated to Firefox 6.0. Now it maxes out the CPU. Please help to solve this issue. I absolutely hate using Chrome or IE !!!

    I tested compatibilty and it says it's not compatible ( no details provided)

    Many thanks b Noir
    This is a copy of ONEof the keys  in the registry I changed  as told by Apple support today. I also have changed others as instructed by GEAR  software support to manually delete GEAR drivers (that I had installed but couldn't delete some of the others  they mentioned from Windows system 32. Then some bright spark at work told me I need the Gear drivers so  I downloaded the software and installed again.
    Sorry, just this minute went to insert image  and it is giving me a message saying this sort of content  is not allowed?.
    The most recent key I altered is in: HKey _local _machine. System\class - 4D36E965-E325-11CEBFC1-08002BE10318. Upper Filter data: Upper filter NTIDrvr  SiRem GEARAspiWDN.
    The GEARsoftware info about manually deleting  GEAR drive is from:
    http://www.gearsoftware.com/wiki/index.php?title=DRIVERS:_Windows_-_Updating%2C_ removing%2C_64_bit_versions%2C_etc
    I hope you can help

  • How do i get the absolute url using javascript?

    I know this isnt a jsp problem but would be grateful if anyone can help.
    In jsp the method request.getRequestURI() would be the equivilent of what I am looking for in javascript.

    document.location

  • Why, since CS6 does DW now use ABSOLUTE image paths when dragging images into Design View from a folder in Finder?!

    While I am grateful the previous issue I had with not being able to drag files into design view at all (in CC and CC2014) was resolved.
    Guys (Adobe), seriously, if you're going to change the functioning of something that used to work just fine, at least supply a way for a user to revert to the old way... I absolutely loathe that I need a legacy version of DW to continue with my current workflow. Please put it back to the way it was, or at least allow a user to chose between the two behaviours.
    If there is a way to do this, without using the Site Manager (which still doesn't work from Finder even with relative to document selected), I would appreciate any guidance.
    As for using the Site Manager (before some smart guy suggests that I just use that) I do not wish to navigate to and create up to 20 "sites" a week and wait for DW to cache them all, when I am already in the folder with the image assets in Finder.
    Also before someone pipes up and says: "You shouldn't be diving sites in design view anyway", I don't... I develop many, many newsletters every week and the folder structure is such that navigation to the actual image folder using the Site Manager would be painful at best.
    I don't really like having to and replace all instances of "file:///Users/me/Work/company/Mailers/Year/wk14/mailer/dev/img/prod5.jpg". It is horrendously wasteful, time-wise.
    Thanks in advance for any helpful replies

    Sorry Murray, DW used to have an idea, my point is that since CS6 its developed a case of Amnesia.
    The "elements" are in the "root" folder as follows:
    newslettername.htm
    img
         imagename.jpg
    So the relative path would be <img src"img/imagename.jpg" />
    However since the change: <img src"file:///Users/me/work/Company/year/week/campaign/img/imagename.jpg" />
    Which is completely useless and needs to be corrected before I upload the html anywhere.
    As for using the site directory, I did answer that in my initial post. I use a laptop, I really don't want a site manager taking half my screen just so I can see the folder structure and navigate with that, especially since I am already at the files I need in Finder.
    Again, this is something that used to work just fine in previous iterations of DW, so I don't believe Adobe is incapable of fixing it nor am I being unreasonable asking for a choice for those that may find the local absolute paths useful in some way. All I want is to be able to chose not to use absolute paths when dragging from Finder.

  • Use absolute encoder to get positioning

    Hi all friends, 
    i am relatively new in labview, and sorry in advance if i ask something very silly. 
     i am writing this to seek help for absolute encoder data acquisition. 
    The DAQ set i am using is NI USB-6218 BNC which has 8 digital inputs. 
    The absolute am using is ACE 128, data sheet is http://www.bourns.com/pdfs/ace.pdf
    I am connecting the 8 output pins of the encoder to the 8 digital input pin P0.0-0.8 
    and then i am using  DAQ Assitant 8 times he input and then convert it to decimal numbers and save it to a text file. 
    attached is what i have. 
    it seems that it works well, but however when i look through the text file, i found that there are a lot of errors in the decimal numbers. 
    can anybody help me to figure out why it happens??
    Thank you very much 
    Attachments:
    EIM sem 5.vi ‏447 KB

    melvinfeng wrote:
    Hi all friends, 
    i am relatively new in labview, and sorry in advance if i ask something very silly. 
     i am writing this to seek help for absolute encoder data acquisition. 
    The DAQ set i am using is NI USB-6218 BNC which has 8 digital inputs. 
    The absolute am using is ACE 128, data sheet is http://www.bourns.com/pdfs/ace.pdf
    I am connecting the 8 output pins of the encoder to the 8 digital input pin P0.0-0.8 
    and then i am using  DAQ Assitant 8 times he input and then convert it to decimal numbers and save it to a text file. 
    attached is what i have. 
    it seems that it works well, but however when i look through the text file, i found that there are a lot of errors in the decimal numbers. 
    can anybody help me to figure out why it happens??
    Thank you very much 
    im confused when you say...."I am connecting the 8 output pins of the encoder to the 8 digital input pin P0.0-0.8", thats not truly a correct statement?
    8 inputs is a port( line0:7)....
    look for the example in the \examples\DAQmx\Digital Input\Digital - SW-Timed Input.vi (change the example data format to decimal output)
    and i dont know if you want to write the data continuous or only when changed to the file?
    Attachments:
    Digital - SW-Timed Input.png ‏18 KB

Maybe you are looking for