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

  • Home
  • SEARCH
  • 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 8202117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:03:37+00:00 2026-06-07T07:03:37+00:00

I am using Swing Application Framework JSR(296) for my Swing based Java application. Similar

  • 0

I am using Swing Application Framework JSR(296) for my Swing based Java application.

Similar to AboutBox, I have followed the usage of @Action and added some JDialog classes to my project.

The problem is, when I close the main frame, my application still runs in background.
To overcome this I added following code to the configureWindow() of my main application class:

protected void configureWindow(java.awt.Window root) {

    root.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
        // write your code here
            Application.getInstance(MyApp.class).exit();
        }
    });
}

But with this modification whenever I close the the dialog (including AboutBox), it also closes the main frame.

What should I do to prevent the entire application from exiting and just close the dialog box?

Update:
I am using NetBeans IDE 7.01 which allows to create Swing Application Framework project.
It generates a project skeleton as shown below:

MyApp 
|--myapp 
|   |--MyApp.java
|   |--MyAppAboutBox.java
|   |--MyAppView.java
|
|--myapp.resources
    |--MyApp.properties
    |--MyAppAboutBox.properties
    |--MyAppView.properties

NetBeans IDE allows to add actions from Window->Properties menu.

MyApp class extends org.jdesktop.application.SingleFrameApplication which is my main class.

MyAppView extends FrameView which is my main view.

Implementation classes of javax.swing.JDialog are in the myapp.view package.

  • 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-07T07:03:39+00:00Added an answer on June 7, 2026 at 7:03 am

    The WindowEvent class has a method call getWindow(), which returns the window that is closing.

    Inside your windowClosing method you can check: if the window is the main application window, use the code that you currently have. If it is not, just call Window.dispose()

    Edit: I didn’t notice that you were creating custom dialogs in your application. Maybe you forget to dispose them? You should add code like the one in the auto generated about box:

    @Action public void closeAboutBox() {
        dispose();
    }
    

    and call this action whenever the dialog closes. If this is not the problem, a thread dump will probably help you in order to find out which thread is running when you close the main window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a desktop app using Java and Swing Application Framework. I have
I am working on a Java Swing Based application using Hibernate. And i have
I am writing an application in java (1.6) using swing. I currently have a
Hi I have created a swing application using java 1.5 and i created a
I have implemented a standalone java application which uses the swing framework for GUI.As
I have created a Java Swing application using JDK 1.6. Many customers are asking
I'm trying to create a SWING application using Java 1.6 and I have a
I have a Java Swing application, developed on Mac OS X 10.5 using Java
I m trying to create a desktop application using swing in java, which allows
I'm using Netbeans 6.7.1 on Windows. I created a Java application using Swing. When

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.