Java Reference
In-Depth Information
L ISTING 7.1 Continued
/**
* ask before leaving the installation
*/
public void quitInstallation() {
int choice = JOptionPane.showConfirmDialog(this,
“Are You Sure?”,
“Quit Installation”,
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE);
if (choice == JOptionPane.CANCEL_OPTION) {
setVisible(true);
return;
}
installationFinished();
}
/**
* obtain the readme file
*/
public String getReadme(){
StringBuffer s = new StringBuffer();
try {
FileReader fr = new FileReader(currentDir + SETUP_RES_DIR + “readme”);
char buffer[] = new char[512];
int i;
while((i = fr.read(buffer)) != -1)
s.append(buffer,0,i);
} catch (Exception ex) {
System.out.println(“during readme file read: “+ex);
}
return s.toString();
}
/**
* invoked at the end of the installation
*/
public void installationFinished(){
System.out.println(“Installation Finished.”);
System.exit(0);
}
Search WWH ::




Custom Search