Thread thread = new Thread(ap);
thread.start();
final WebserviceInfo thisinfo = this;
- frame
- .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
- {
- public void internalFrameClosed(
- javax.swing.event.InternalFrameEvent evt)
- {
- // System.out.println("Shutting down webservice client");
- WSClientI service = thisinfo.getthisService();
- if (service != null && service.isCancellable())
- {
- service.cancelJob();
- }
- };
- });
+ frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+ {
+ public void internalFrameClosed(
+ javax.swing.event.InternalFrameEvent evt)
+ {
+ // System.out.println("Shutting down webservice client");
+ WSClientI service = thisinfo.getthisService();
+ if (service != null && service.isCancellable())
+ {
+ service.cancelJob();
+ }
+ };
+ });
}
// anyhow - it has to stop threads and clean up
// JBPNote : TODO: Instead of a warning, we should have an optional 'Are
// you sure?' prompt
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "This job cannot be cancelled.\nJust close the window.",
- "Cancel job", JOptionPane.WARNING_MESSAGE);
+ warnUser("This job cannot be cancelled.\nJust close the window.",
+ "Cancel job");
}
else
{
}
/**
+ * Spawns a thread that pops up a warning dialog box with the given message
+ * and title.
+ *
+ * @param message
+ * @param title
+ */
+ public void warnUser(final String message, final String title)
+ {
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop, message,
+ title, JOptionPane.WARNING_MESSAGE);
+
+ }
+ });
+ }
+
+ /**
* Set up GUI for user to get at results - and possibly automatically display
* them if viewResultsImmediatly is set.
*/