How to have an interactive map in JFrame

  1. Get a map of the United States
  2. Draw it on a JPanel
  3. Add a click handler to the JPanel
  4. In the click handler, retrieve information where the user clicked from the event
  5. Have a set of polygons of all the state boundaries
  6. Iterate through all the poloygons to check if the user clicked inside one
  7. Return the associated state

Leave a Comment