import javax.swing.WindowConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
import org.forester.analysis.TaxonomyDataManager;
import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
setSize( MainFrameApplication.FRAME_X_SIZE, MainFrameApplication.FRAME_Y_SIZE );
// The window listener
setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
- addWindowListener( new WindowAdapter() {
+ addInternalFrameListener( new InternalFrameAdapter() {
@Override
- public void windowClosing( final WindowEvent e ) {
+ public void internalFrameClosing (final InternalFrameEvent e ) {
exit();
}
} );
// } );
// The window listener
setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
- addWindowListener( new WindowAdapter() {
+
+ addInternalFrameListener( new InternalFrameAdapter() {
@Override
- public void windowClosing( final WindowEvent e ) {
+ public void internalFrameClosing( final InternalFrameEvent e ) {
+ if (MainFrameApplication.this.getParent() == null) {
if ( isUnsavedDataPresent() ) {
- final int r = JOptionPane.showConfirmDialog( null,
- "Exit despite potentially unsaved changes?",
- "Exit?",
+ final int r = JOptionPane.showConfirmDialog( _mainpanel,
+ "Close Archaeopteryx despite potentially unsaved changes?",
+ "Close viewer?",
JOptionPane.YES_NO_OPTION );
if ( r != JOptionPane.YES_OPTION ) {
return;
if ( r != JOptionPane.YES_OPTION ) {
return;
}
- }
+ }}
exit();
- }
- } );
+
+ } });
// The component listener
addComponentListener( new ComponentAdapter() {