Results 1 to 2 of 2
  1. #1
    cchase88 is offline Member
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    0

    Default Making a map program

    Hey everyone, I've been trying to create a simple map program using different methods, but they have all fallen short.

    What I'm trying to create is a map program in which an image is loaded and on top of this image buttons are placed on specified areas, so that when a user clicks these buttons, a pop-up box will be displayed with information about that area/building. I would like the image along with the overlaying buttons to be in a JScrollpane and I will be adding click and drag support so the scroll bars aren't the only way to navigate around the map. I'll be adding this scrollpane to a JFrame which will also have a panel that holds controls.

    I've tried using a JLayeredPane to hold a panel with the image, and then add the buttons over it, but I can't seem to get the buttons to draw correctly. I've also tried using the OverlayLayout, but without much success.

    I was wondering if anyone could point out a better technique of developing an application like this. Should I be using Java2D instead of the methods I've tried?

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

    Default

    Quote Originally Posted by cchase88 View Post
    What I'm trying to create is a map program in which an image is loaded and on top of this image buttons are placed on specified areas, so that when a user clicks these buttons, a pop-up box will be displayed with information about that area/building. I would like the image along with the overlaying buttons to be in a JScrollpane and I will be adding click and drag support so the scroll bars aren't the only way to navigate around the map. I'll be adding this scrollpane to a JFrame which will also have a panel that holds controls.

    I've tried using a JLayeredPane to hold a panel with the image, and then add the buttons over it, but I can't seem to get the buttons to draw correctly. I've also tried using the OverlayLayout, but without much success.

    I was wondering if anyone could point out a better technique of developing an application like this. Should I be using Java2D instead of the methods I've tried?
    I don't think that you need to go to the trouble of using JLayeredPane or OverlayLayout as the image can be simply a JPanel's background image painted in a paintComponent override. I think layered panes are useful when dragging images or components on top of another, such as in a chess or checkers game, but your images are static and so this is not required.

    Also, I would solve one issue at a time in isolation of the others though rather than trying to solve the whole thing in one big huge program.

    Much luck!

Similar Threads

  1. difficulty making java program, Help Me
    By 3c4hy0 in forum New To Java
    Replies: 11
    Last Post: 08-13-2010, 12:08 PM
  2. Need help making program more efficient
    By cid in forum New To Java
    Replies: 4
    Last Post: 06-30-2010, 07:22 PM
  3. Making the program
    By pheonix in forum Advanced Java
    Replies: 4
    Last Post: 04-18-2009, 06:36 AM
  4. Help Making a program not crash
    By Lifeis2evil in forum New To Java
    Replies: 2
    Last Post: 12-10-2008, 03:10 AM
  5. Need help with Java classes for making a program.
    By TheDarkReverend in forum Advanced Java
    Replies: 2
    Last Post: 11-28-2008, 04:50 AM

Tags for this Thread

Posting Permissions

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