@@ -0,0 +1,808 @@
+%0Apackage net.restlesscoder.sandbox;%0A%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A%0Aimport javax.swing.JButton;%0Aimport javax.swing.JFrame;%0Aimport javax.swing.WindowConstants;%0A%0Aimport net.imagej.ImageJ;%0A%0Apublic class IJDispose %7B%0A%0A%09public static void main(final String... args) %7B%0A%09%09final ImageJ ij = new ImageJ();%0A%09%09ij.ui().showUI();%0A%0A%09%09final JFrame frame = new JFrame(%22Hello%22);%0A%09%09final JButton b = new JButton(%22Close ImageJ%22);%0A%09%09b.addActionListener(new ActionListener() %7B%0A%09%09%09@Override%0A%09%09%09public void actionPerformed(final ActionEvent e) %7B%0A%09%09%09%09ij.thread().getExecutorService().shutdownNow();%0A%09%09%09%09ij.getContext().dispose();%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09frame.getContentPane().add(b);%0A%09%09frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);%0A%09%09frame.pack();%0A%09%09frame.setVisible(true);%0A%09%7D%0A%0A%7D%0A

Add a little test of ImageJ2's context disposal