System.setOut(aPrintStream); // catches System.out messages
System.setErr(aPrintStream); // catches error messages
// signal condition if continue button hit
final Lock lock = new ReentrantLock();
final Condition cont = lock.newCondition();
wsform._GO_BUTTON.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
lock.lock();
cont.signal();
lock.unlock();
}
});
wsform._SHOW_CONF_BUTTON.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
showFile(configuration);
}
});
wsform._SELECT_FOLDER_BUTTON.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JFileChooser fc = new JFileChooser();
fc.setCurrentDirectory(new File("."));
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fc.setAcceptAllFileFilterUsed(false);
int retval = fc.showOpenDialog(wsform);
if (retval == JFileChooser.APPROVE_OPTION)
{
// ... The user selected a file, get it, use it.
File file = fc.getSelectedFile();
// ... Update user interface.
try
{
wsform._INSTALL_FOLDER.setText(file.getCanonicalPath());
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
}
});
// exit if cancel button hit
wsform._CANCEL_BUTTON.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
});
JFrame frame = new JFrame();
frame.setTitle(TITLE);
frame.setSize(530, 450);
frame.setLocation(100, 100);
frame.getContentPane().add(wsform);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent evt)
{
System.exit(0);
}
});
showStep("Click button to continue");
// wait for continue button
lock.lock();
cont.await();
lock.unlock();
// get user data
destination = wsform._INSTALL_FOLDER.getText();
if (wsform._INSTALL_OPTION.isSelected())
{