final VncViewersList clients= new VncViewersList();
clients.loadHosts(file, "");
System.out.println("loaded " + clients.size());
// set up progress bar window
final ProgressBarDialog progDlg=
new ProgressBarDialog(this, PROG_BROADCAST, 0, clients.size());
progDlg.setModal(true);
// broadcast to everybody, but do it
// on the background thread so that we
// can show a progress dialog
new Thread() {
public void run() {
try {
VncBroadcaster.broadcast(clients, progDlg.getModel());
} catch (final Exception e) {
System.out.println(e);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JOptionPane.showMessageDialog(
VncEasyBroadcastWindow.this,
e.toString());
}
});
}
// close the progress dialog on the swing thread
SwingUtilities.invokeLater(new Runnable() {
public void run() {
progDlg.setVisible(false);
}
});
}
}.start();
progDlg.setVisible(true);
this.quit();
}