Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8121617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:33:04+00:00 2026-06-06T05:33:04+00:00

I need to add functionality to the close button in my class that extends

  • 0

I need to add functionality to the close button in my class that extends the JXMapKit (like saving the location and *EXIT_ON_CLOSE* ). The main() method is just a copy-paste of the original main method of the JXMapKit.

I have the following simple code to use the JXMapKit:

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import org.jdesktop.swingx.mapviewer.DefaultTileFactory;
import org.jdesktop.swingx.mapviewer.GeoPosition;
import org.jdesktop.swingx.mapviewer.TileFactory;
import org.jdesktop.swingx.mapviewer.TileFactoryInfo;



@SuppressWarnings("serial")
public class MyMap extends JXMapKit{
public static void main(String ... args){
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            JXMapKit kit = new JXMapKit();
            kit.setDefaultProvider(DefaultProviders.OpenStreetMaps);


            final int max = 17;
            TileFactoryInfo info = new TileFactoryInfo(1,max-2,max,
                    256, true, true, // tile size is 256 and x/y orientation is normal
                    "http://tile.openstreetmap.org",//5/15/10.png",
                    "x","y","z") {
                public String getTileUrl(int x, int y, int zoom) {
                    zoom = max-zoom;
                    String url = this.baseURL +"/"+zoom+"/"+x+"/"+y+".png";
                    return url;
                }

            };
            TileFactory tf = new DefaultTileFactory(info);
            kit.setTileFactory(tf);
            kit.setZoom(14);
            kit.setAddressLocation(new GeoPosition(22.5697, 88.3697));//coordinates of Kolkata
            kit.getMainMap().setDrawTileBorders(true);
            kit.getMainMap().setRestrictOutsidePanning(true);
            kit.getMainMap().setHorizontalWrapped(false);

            ((DefaultTileFactory)kit.getMainMap().getTileFactory()).setThreadPoolSize(8);
            JFrame frame = new JFrame("JXMapKit test");
            frame.add(kit);
            frame.pack();
            frame.setSize(500,300);
            frame.setVisible(true);
        }
    });
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:33:06+00:00Added an answer on June 6, 2026 at 5:33 am

    The following code solves the problem:

    myFrame.addWindowListener(
        new WindowAdapter(){
             public void windowClosed(WindowEvent e) { System.exit(0); }
        }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to add functionality to that button, but i dont know the name
i need to add some functionality to an asp.net application that allows the positioning
I need to be able to add sharing functionality to my custom button. I'm
I need to add functionality to my iPad app so that I can save
I need to add functionality in my program so that any file imported it
I have a legacy C API that I need to add functionality to. Specifically
I need to add test functionality for RMI connection (checking if the server on
I need to add a new functionality into my app. I must store a
I need to add an invite users functionality to my social networking application so
As part of an editor project, I need to add functionality to the WPF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.