Skip to main content

JXErrorPane Dialog is not always closing after a FATAL error

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
tl5
Offline
Joined: 2008-11-20
Points: 0

On closing a JXErrorPane-Dialog the surrounding application should be closed too, if an ErrorLevel of FATAL is given to it.
This works as expected if I click on the Window-Close-Icon or if I select close from the Dialog-Icon-Menu. But the application is not closed after clicking on the JX-ErrorPane-Button labeled "Exit Application".

Here is some code to reproduce the problem:

public class ErrorPaneDemo extends JPanel
{
public ErrorPaneDemo()
{
ErrorInfo info =
new ErrorInfo( "title", "basic error message", null, "category", new Exception(), ErrorLevel.FATAL,
null );
JXErrorPane.showDialog( null, info );
add( new JLabel( "it goes on and on and on..." ) );//This is shown in a frame if the application is not System.exited
}

public static void main( String[] args )
{
SwingUtilities.invokeLater( new Runnable()
{
public void run()
{
JFrame frame = new JFrame();
frame.getContentPane().add( new ErrorPaneDemo() );
frame.setPreferredSize( new Dimension( 800, 600 ) );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible( true );
}
} );
}
}

I found the method exitIfFatal() in the BasicErrorPaneUI. Is it a bug that this method is not called by the button-action? How could I fix this?