Updated rest function with a JDialog box