Note that there are some explanatory texts on larger screens.

plurals
  1. POWindow closing in Swing Application Framework
    primarykey
    data
    text
    <p>I am using Swing Application Framework JSR(296) for my Swing based Java application.</p> <p>Similar to AboutBox, I have followed the usage of @Action and added some JDialog classes to my project.</p> <p>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:</p> <pre><code>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(); } }); } </code></pre> <p>But with this modification whenever I close the the dialog (including AboutBox), it also closes the main frame.</p> <p>What should I do to prevent the entire application from exiting and just close the dialog box?</p> <p><strong>Update:</strong> I am using NetBeans IDE 7.01 which allows to create Swing Application Framework project. It generates a project skeleton as shown below:</p> <pre><code>MyApp |--myapp | |--MyApp.java | |--MyAppAboutBox.java | |--MyAppView.java | |--myapp.resources |--MyApp.properties |--MyAppAboutBox.properties |--MyAppView.properties </code></pre> <p>NetBeans IDE allows to add actions from <em>Window->Properties menu</em>.</p> <p>MyApp class extends org.jdesktop.application.SingleFrameApplication which is my main class.</p> <p><code>MyAppView extends FrameView</code> which is my main view. </p> <p>Implementation classes of <code>javax.swing.JDialog</code> are in the <code>myapp.view</code> package.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload