added new OSX QuitHandler

This commit is contained in:
Denis Molony 2018-04-26 08:21:51 +10:00
parent 04bbe6ceab
commit d65c4dfe44

View File

@ -3,10 +3,14 @@ package com.bytezone.diskbrowser.gui;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.desktop.QuitEvent;
import java.awt.desktop.QuitHandler;
import java.awt.desktop.QuitResponse;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.swing.*; import javax.swing.*;
import com.apple.eawt.Application;
import com.bytezone.common.Platform; import com.bytezone.common.Platform;
import com.bytezone.common.QuitAction; import com.bytezone.common.QuitAction;
import com.bytezone.common.QuitAction.QuitListener; import com.bytezone.common.QuitAction.QuitListener;
@ -127,6 +131,15 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
quitAction.addQuitListener (diskLayoutPanel); quitAction.addQuitListener (diskLayoutPanel);
quitAction.addQuitListener (this); quitAction.addQuitListener (this);
Application.getApplication ().setQuitHandler (new QuitHandler ()
{
@Override
public void handleQuitRequestWith (QuitEvent e, QuitResponse response)
{
quitAction.quit ();
}
});
catalogPanel.setCloseTabAction (closeTabAction); catalogPanel.setCloseTabAction (closeTabAction);
pack (); pack ();