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.


>> REGISTER NOW TO START POSTING


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

Page 2 of 2 FirstFirst 12
Results 26 to 27 of 27

Thread: Simple Google Maps like Image viewer in Java

  1. #26
    Junior Member
    Join Date
    Dec 2011
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Simple Google Maps like Image viewer in Java

    Quote Originally Posted by Mr.777 View Post
    Well, i can not tell you, what to write but can guide you as forums rules don't allow to spoon feed. So, i can simply tell you one more thing, that your painComponent() function is drawing the image everytime at the same location, so that when you release the mouse, it gets back to it's original position that is set in your function like,
    g2D.drawImage(bi, dx, dy, scale*image.getWidth(this), scale*image.getHeight(this), this);
    So, as a hint i can tell you, when you move the image to some place, get the coordinates and place in the above line so that your image drawing must be generic everytime, not hard coded. As above mentioned line.
    I understand that you are telling me not to use hard coded parameters like dx and dy. But logically lastx and lasty will be the last position where the image is, but if I use lastx and lasty in the drawImage function, it still jumps.

  2. #27
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Simple Google Maps like Image viewer in Java

    It jumps coz the size of image is too large and it takes your image to the mouse position whenever you try to drag it.
    Hint: Let mouse drag the image if mouse is inside the image coordinates.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. How to use google maps in a frame and get string
    By Nesh108 in forum Java Theory & Questions
    Replies: 26
    Last Post: November 29th, 2012, 11:27 AM
  2. Replies: 0
    Last Post: September 15th, 2011, 07:44 AM
  3. Java Image Viewer undo function
    By mccaffrey in forum AWT / Java Swing
    Replies: 0
    Last Post: April 21st, 2011, 05:28 PM
  4. JAVA and Google Maps
    By aussiemcgr in forum Java Theory & Questions
    Replies: 7
    Last Post: February 1st, 2011, 08:57 PM
  5. Convert Maps of String to Map of Maps
    By abhay8nitt in forum Collections and Generics
    Replies: 1
    Last Post: October 27th, 2009, 08:27 AM