Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Mapping real coordinates into GUI

  1. #1
    Junior Member
    Join Date
    May 2011
    Thanked 0 Times in 0 Posts

    Default Mapping real coordinates into GUI

    Hi every body,

    I am new to java but I have good background in C++ .

    I want to use java to represent real coordinates on a graphical sequare.

    to clarify the idea, I have a square area in real word and there is an object that

    located at this square. For example: the location of the object is (2,1) and I want to represent this coordinate on graphical interface.

    please see the pic

    Is there any tool that may help me to do that? or I should do that manually?

    Any help will be appreciated.

    Thanks in advanc

  2. #2
    Forum old-timer
    Join Date
    Nov 2008
    Faversham, Kent, UK
    My Mood
    Thanked 58 Times in 54 Posts

    Default Re: Mapping real coordinates into GUI

    You can just write a mapping method that takes real-world coordinates and converts them to GUI coordinates. Your GUI display component will have a certain width and height in pixels, and the real-world area you're dealing with will have a certain range, so you can calculate the X and Y factors to multiply by to convert real-world coordinates to GUI component coordinates. For example, if the real-world X range is 10 and the GUI component width is 800, then you'd multiply real-world X values by 800/10 to get the pixel X value, and so-on.

  3. The Following 2 Users Say Thank You to dlorde For This Useful Post:

    gloor (May 28th, 2011), JavaPF (May 26th, 2011)

  4. #3
    Junior Member
    Join Date
    May 2011
    Thanked 0 Times in 0 Posts

    Red face Re: Mapping real coordinates into GUI

    Thank you so much

    I will do something like that

    Thanx again

Similar Threads

  1. Retrieve coordinates of other windows
    By Knox in forum AWT / Java Swing
    Replies: 1
    Last Post: April 10th, 2011, 02:03 PM
  2. URL-Mapping
    By newbie in forum Web Frameworks
    Replies: 0
    Last Post: March 29th, 2011, 06:23 PM
  3. Testing if dates are real or not.
    By cardsfan33 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 22nd, 2011, 07:46 PM
  4. Storing data from a socket to a file in real time
    By colossusdub in forum Java Networking
    Replies: 0
    Last Post: March 2nd, 2010, 09:10 AM
  5. Changing colors of large image in real time
    By chals in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: May 7th, 2009, 05:06 AM