
import javax.swing.*;
import java.awt.*;

public class Interruption extends JFrame
{
	public Interruption ()
	{
		super ("Demo");

		JLabel celluleclic = new JLabel ("Label factice ");
		this.getContentPane ().add (celluleclic);

		// register the shutdown hook :
		Runtime.getRuntime ().addShutdownHook (new MonShutdownHook ());

		this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
		this.setLocation (200, 200);
		this.pack ();
		this.setVisible (true);
	}


	public static void main (String argv [])
	{
		new Interruption ();
	}
}

class MonShutdownHook extends Thread
{
	public MonShutdownHook ()
	{
	}

	// traitement qui sera effectue suite à une interruption du programme
	public void run ()
	{
		System.out.println ("interrompu");
	}
}
