Change Preview.class to a JOptionPane to avoid freeze bug