Results 1 to 5 of 5
  1. #1
    lolmasterzz is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default Resizing Coordinates In Applets

    Hey guys,

    I was wondering how to resize coordinates in a simple java applet. I'm not trying to resize the window. Instead, I'm trying to make the window such that if you resize the coordinates it shows coordinates that weren't visible before.

    Thanks!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Please clarify by posting the details of what you are trying to do. Thanks and good luck.

  3. #3
    lolmasterzz is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default

    so basically I am doing a nearest neighbor heuristic for the travelling salesman problem. however, my applet window only has a certain range for the coordinates and i want my salesman to visit a coordinate that doesn't show up on my window. Is there a way to resize the coordinates such that this point shows up?

    Thanks

  4. #4
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    7

    Default

    Welcome lolmasterzz, to Java Forums. ;)

    I assume that you draw your coordinates on a graphics object. Add an offset to the points before you draw them. You can use this offset to scroll across the "pane" where you draw your points. So, if the salesman moves to a point off the screen, set the offset such that the salesman is drawn onscreen. Or, you can draw on a large panel that covers all the points. Add this panel to a JScrollPane. When the salesman moves out of view, you can set the view point if the JScrollPane so that the salesman is visible again. ;)

    Hope that helps, lolmasterzz. If you like, I could give you an example. :)
    Last edited by tim; 07-10-2009 at 12:14 PM.
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  5. #5
    lolmasterzz is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default

    alright thanks for help! I'll try it out and see if it works.

Similar Threads

  1. JFrame resizing problem
    By Bluefox815 in forum AWT / Swing
    Replies: 7
    Last Post: 02-24-2011, 07:56 PM
  2. Resizing Images in JPanel??
    By NoNickName in forum New To Java
    Replies: 1
    Last Post: 04-09-2009, 10:19 PM
  3. panel resizing
    By kumar_gemi in forum New To Java
    Replies: 3
    Last Post: 03-13-2009, 02:51 AM
  4. Image Resizing and DPi
    By Rob_ in forum Java Applets
    Replies: 4
    Last Post: 11-27-2008, 02:21 PM
  5. Image resizing
    By alley in forum Java 2D
    Replies: 2
    Last Post: 11-13-2007, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •