• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Need help to solve this co-ordinate & pixel problem ?

 
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem in hand , it is related to my Java application , let me explain you my problem
suppose there are 2 computers lets name it computer "A" and computer "B" computer "A" has a screen resolution 1440*900 and computer "B" has a screen resolution of 1024*600 so when I take my mouse pointer to gmail button at the google homepage from computer "A" i get a X & Y co-ordinates like 204,110 and when i did the same from "B" computer then I get different X and Y co-ordinates what as a developer i can do to make sure that the co-ordinates will be same regardless of the screen resolution ?
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

naved momin wrote:what as a developer i can do to make sure that the co-ordinates will be same regardless of the screen resolution ?


I'm no GUI expert, but I suspect strongly that you're confusing the problem with the solution (or rather, a solution).

Even assuming that you do have to move your mouse to the correct location (and I suspect you don't), there are several possible solutions to the issue; just one of which is that every visible component on a screen has a "rectangle" that it fits in, which is defined by its 'origin' (the location of its top left corner), its width and its height.

Given those 3, it should be a simple matter to move the mouse pointer to the centre of the component, regardless of screen resolution.

Winston
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

naved momin wrote:what as a developer i can do to make sure that the co-ordinates will be same regardless of the screen resolution ?


I'm no GUI expert, but I suspect strongly that you're confusing the problem with the solution (or rather, a solution).

Even assuming that you do have to move your mouse to the correct location (and I suspect you don't), there are several possible solutions to the issue; just one of which is that every visible component on a screen has a "rectangle" that it fits in, which is defined by its 'origin' (the location of its top left corner), its width and its height.

Given those 3, it should be a simple matter to move the mouse pointer to the centre of the component, regardless of screen resolution.

Winston


yes thats true for the desktop icons , because at desktop we get an rectangle position so we can point to any where within that rectangle of the icon for double click to take effect but in the web browser , I got the scenario i have described in my 1st post "the gmail button problem"
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

naved momin wrote:what as a developer i can do to make sure that the co-ordinates will be same regardless of the screen resolution ?


I'm no GUI expert, but I suspect strongly that you're confusing the problem with the solution (or rather, a solution).

Even assuming that you do have to move your mouse to the correct location (and I suspect you don't), there are several possible solutions to the issue; just one of which is that every visible component on a screen has a "rectangle" that it fits in, which is defined by its 'origin' (the location of its top left corner), its width and its height.

Given those 3, it should be a simple matter to move the mouse pointer to the centre of the component, regardless of screen resolution.

Winston


Let me explain you or any one who is willing to help me one more time, this the results what i get while testing on my pc at screen resolution 1440*900
XMIN = 1306 // this are address of the pixel in terms of x and y cordinates in which a "sign in" button is located on the google.co.in "in the right hand side"
YMIN = 145
XMAX = 1338
YMAX = 177
XMIN & YMIN are the address of the pixel in terms of X & Y co-ordinates "from where" the click can take effect
XMAX & YMAX are the address of the pixel in terms of X & Y co-ordinates "up to which" the click can take effect
and if the screen resolution changes then this pixels address (ie x and y coordinates) might change so how to solve this ....
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

naved momin wrote:and if the screen resolution changes then this pixels address (ie x and y coordinates) might change so how to solve this ....


Surely, if the screen resolution changes, those values will change.

Winston
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

naved momin wrote:and if the screen resolution changes then this pixels address (ie x and y coordinates) might change so how to solve this ....


Surely, if the screen resolution changes, those values will change.

Winston


so whats your solution for that to keep the x and y co-ordinates same regardless of resolution ?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

naved momin wrote:so whats your solution for that to keep the x and y co-ordinates same regardless of resolution ?


The coordinates depend on many things, and screen resolution is not one of them. At least not directly.

The coordinates are determined by (among others):
  • the position and size of the browser window (there could even be multiple displays, complicating things further),
  • extensions and themes installed in the browser (since these can influence eg. the size and number of displayed toolbars),
  • font sizes and types used by the browser, which are user configurable,
  • OS visual themes or personalisations (as these can change sizes of window borders and titles),
  • possible user customization of the Google homepage,
  • last but not least, on the number and location of links Google decides to put on its home page.


  • I completely fail to see what you're actually trying to do, but given existing constraints listed above, I'd say it is not possible to derive the coordinates just from the screen resolution. For a very limited case (such as two computers with given settings, maximized browser window, fixed configuration etc.) some formula for determining the coordinates might perhaps be found. (If I was forced to do something like this, I'd simply note the coordinates for every screen resolution that would be ever used on the computers.)
     
    Winston Gutkowski
    Bartender
    Posts: 10780
    71
    Hibernate Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    naved momin wrote:so whats your solution for that to keep the x and y co-ordinates same regardless of resolution ?


    Why on earth would you need that?
    Like I say, you're describing a solution, not the problem.

    Winston
     
    naved momin
    Ranch Hand
    Posts: 692
    Eclipse IDE Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Martin Vajsar wrote:

    naved momin wrote:so whats your solution for that to keep the x and y co-ordinates same regardless of resolution ?


    The coordinates depend on many things, and screen resolution is not one of them. At least not directly.

    The coordinates are determined by (among others):
  • the position and size of the browser window (there could even be multiple displays, complicating things further),
  • extensions and themes installed in the browser (since these can influence eg. the size and number of displayed toolbars),
  • font sizes and types used by the browser, which are user configurable,
  • OS visual themes or personalisations (as these can change sizes of window borders and titles),
  • possible user customization of the Google homepage,
  • last but not least, on the number and location of links Google decides to put on its home page.


  • I completely fail to see what you're actually trying to do, but given existing constraints listed above, I'd say it is not possible to derive the coordinates just from the screen resolution. For a very limited case (such as two computers with given settings, maximized browser window, fixed configuration etc.) some formula for determining the coordinates might perhaps be found. (If I was forced to do something like this, I'd simply note the coordinates for every screen resolution that would be ever used on the computers.)


    yes martin I realize that today when i was testing my application on two different machine but this time both have the same resolution but different monitor size one was 17inch display and another just 14 or 15 inch , and i guess you are very much close to what my problem is , let me explain to you and @wiston , i have to develop and app that allows you to take control over the mouse of another pc and ofcource both will be connect through socket , now what this app is for ?
    this app will help the support team to show the clients or solve the clients problem just by showing them how different modules of any web application can be used (just with the mouse clicks ) so far i have accomplish to move the mouse but soon run into major problem ... the problem is suppose you are my client and i want to show you how gmail works then what i will do is connect to you pc(in some manner) and take control over the mouse of your and start chrome or mozilla whatever and take your mouse pointer to gmail button on the google.com and click on it .
    but the catch here is I am just expecting that if i take my mouse over the gmail button then 100% the other computers mouse will also point to the gmail button but thats what not happening the mouse at the another computer stays some where else , just because of the resolution or screen size and many factors that martin has told so what can i do to rest-a-sure that if one guy take the mouse control over the gmail button then the mouse pointer of another which is connected should also point to the gmail button. hope now you guys are clear what i m trying to do and can you help me now , if you have any other doubts feel free to message me on ranch.
     
    Winston Gutkowski
    Bartender
    Posts: 10780
    71
    Hibernate Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    naved momin wrote:let me explain to you and @wiston , i have to develop and app that allows you to take control over the mouse of another pc and ofcource both will be connect through socket...


    Ooof. I see your problem (finally); and I suspect you have quite a task ahead of you.

    VNC, which was created via a joint development team of Olivetti Labs with Cambridge University, took more than 2 years to develop. Remote desktop software is NOT easy (and the problem you've uncovered is merely one in a LONG list).

    First: Is this a development project for school/university, or do you simply need the capability? If the latter, I'd just download a copy of VNC or Butterfly and use that (the latter may not be free - certainly wasn't in my time; but it's nice. VNC is).

    Second: I suspect you'd still be better off coupling "remote screen" (for you) and "remote mouse" (for them) software together and simply running the GUI on the client as normal; however, since both are driver-based, the chances are you'll have problems writing a Java application for either, unless you want to get down-and-dirty with things like X.

    Even if this is a class exercise:
    1. Sometimes the best solution has already been written.
    2. Sometimes the correct answer is: N/A (not applicable). But be sure you can back up your answer.

    Winston
     
    Martin Vashko
    Sheriff
    Posts: 3837
    66
    Netbeans IDE Oracle Firefox Browser
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    So you want to do this: have a support guy move the mouse cursor somewhere, identify the region where he moved it and move the cursor at a remote computer to functionally identical region on the screen. Tall order!

    Moving the mouse cursor blindly across the screen of another computer is probably not a workable idea. If you want to guide someone, you actually need to see his screen (support is not main part of my work, but I've already spent some time on the phone, trying to understand what the person on the other end of the line sees on his screen). This would sidestep your "coordinates" problem, because you would see where you need to click.

    I'd say writing such application in Java is very daunting task, bordering on the impossible. I can imagine some very basic functionality being done, especially if you're interested only in transferring mouse actions and don't need to catch and transfer keyboard shortcuts and other niceties. Several such programs actually exist, such as VNC or TeamViewer, and you might want to evaluate whether these options - even if the wouldn't be free - would not match your needs better.
     
    naved momin
    Ranch Hand
    Posts: 692
    Eclipse IDE Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Winston Gutkowski wrote:

    naved momin wrote:let me explain to you and @wiston , i have to develop and app that allows you to take control over the mouse of another pc and ofcource both will be connect through socket...


    Ooof. I see your problem (finally); and I suspect you have quite a task ahead of you.

    VNC, which was created via a joint development team of Olivetti Labs with Cambridge University, took more than 2 years to develop. Remote desktop software is NOT easy (and the problem you've uncovered is merely one in a LONG list).

    First: Is this a development project for school/university, or do you simply need the capability? If the latter, I'd just download a copy of VNC or Butterfly and use that (the latter may not be free - certainly wasn't in my time; but it's nice. VNC is).

    Second: I suspect you'd still be better off coupling "remote screen" (for you) and "remote mouse" (for them) software together and simply running the GUI on the client as normal; however, since both are driver-based, the chances are you'll have problems writing a Java application for either, unless you want to get down-and-dirty with things like X.

    Even if this is a class exercise:
    1. Sometimes the best solution has already been written.
    2. Sometimes the correct answer is: N/A (not applicable). But be sure you can back up your answer.

    Winston


    thanks winston and martin and i would like to say you guys couple of things
    1. this is not and school project nor i need this functionality because TeamViewer is on my desktop , but i like the idea, working and application of developing this application and that's why i need to develop this application
    2. after all the cakes and watermelon you guys means this is impossible in java , i need to go down to c or c++
    3. if i write this same application in c or c++, I thing i m goona stuck at the same level where display co-ordinates differs from computer to computer
    4. so what can we do ? we have to find a middle way to accomplish this task ? does you guys know any ?
    let us rephrase what this application is , this application is not Remote control software but it is a kind of remote control software in which one person can take over the control of another computers mouse and perform "web" related task just for now , for e.g: clicking gmail button , etc
     
    naved momin
    Ranch Hand
    Posts: 692
    Eclipse IDE Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    naved momin wrote:

    Winston Gutkowski wrote:

    naved momin wrote:let me explain to you and @wiston , i have to develop and app that allows you to take control over the mouse of another pc and ofcource both will be connect through socket...


    Ooof. I see your problem (finally); and I suspect you have quite a task ahead of you.

    VNC, which was created via a joint development team of Olivetti Labs with Cambridge University, took more than 2 years to develop. Remote desktop software is NOT easy (and the problem you've uncovered is merely one in a LONG list).

    First: Is this a development project for school/university, or do you simply need the capability? If the latter, I'd just download a copy of VNC or Butterfly and use that (the latter may not be free - certainly wasn't in my time; but it's nice. VNC is).

    Second: I suspect you'd still be better off coupling "remote screen" (for you) and "remote mouse" (for them) software together and simply running the GUI on the client as normal; however, since both are driver-based, the chances are you'll have problems writing a Java application for either, unless you want to get down-and-dirty with things like X.

    Even if this is a class exercise:
    1. Sometimes the best solution has already been written.
    2. Sometimes the correct answer is: N/A (not applicable). But be sure you can back up your answer.

    Winston


    thanks winston and martin and i would like to say you guys couple of things
    1. this is not and school project nor i need this functionality because TeamViewer is on my desktop , but i like the idea, working and application of developing this application and that's why i need to develop this application
    2. after all the cakes and watermelon you guys means this is impossible in java , i need to go down to c or c++
    3. if i write this same application in c or c++, I thing i m goona stuck at the same level where display co-ordinates differs from computer to computer
    4. so what can we do ? we have to find a middle way to accomplish this task ? does you guys know any ?
    let us rephrase what this application is , this application is not Remote control software but it is a kind of remote control software in which one person can take over the control of another computers mouse and perform "web" related task just for now , for e.g: clicking gmail button , etc


    i have got some thing I will implement that in next 36 hours of coding and tell you guys k bye and thanks for the help
     
    naved momin
    Ranch Hand
    Posts: 692
    Eclipse IDE Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi guys i m back with some bad as well as good news first i will tell you what i did
    what i thought is that i will capture the screen shots using Robot class then i will serialize it and send it over the network at every 100 millisecond and at the server i will just pull that image and display it in a label which will give a perception of motion , but in practice the label as well as frame gets hanged up
    then i began to search some alternative , and i came to know that the product like TeamViewer and all what they do is
    1. they capture the screen shots at regular interval
    2. store it locally
    3. make a video from images they have stored and then transfer them to the server
    4. server just display them as a media player like FLV player and like.

    so after knowing this much , i think this gonna be tuff as well as take time , but i want to implement it
    so i have searched a library called xuggle which allows you to make videos from still images using ffmpeg library

    so do you know some other great tool that i can utilize while working on this ?
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic