package view;

import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import controller.GestionArticle;

@SuppressWarnings("serial")
public class ConfirmExitDialog extends JFrame {


	public ConfirmExitDialog(String str) {
		super(str);
		//this.setSize(350, 150);

	}
	protected void processWindowEvent(WindowEvent e) {


		if (e.getID() == WindowEvent.WINDOW_CLOSING) {

			int exit = JOptionPane.showConfirmDialog(this, "Voulez vous sauvegarder ?");
			if (exit == JOptionPane.YES_OPTION) {
				GestionArticle.sauvegarderArticles();
				System.exit(0);
			}else if (exit == JOptionPane.NO_OPTION) {
				System.exit(0);
			}

		} else {
			super.processWindowEvent(e);
		}
	}

}

