Java Reference
In-Depth Information
L ISTING 7.6 Continued
/**
* Chapter 7 - The installer applet
*
* @author Mauro Marinilli
* @version 1.0
*/
public class InstallerApplet extends JApplet {
boolean isStandalone = false;
JLabel titleLabel = new JLabel();
JTextArea messagesArea = new JTextArea();
/**Get a parameter value*/
public String getParameter(String key) {
if (isStandalone)
return System.getProperty(key);
return super.getParameter(key);
}
/**Construct the applet*/
public InstallerApplet() {
}
/**Initialize the applet*/
public void init() {
titleLabel.setText(“<html><body><b>”+
“<i>”+getParameter(“appname”)+
“</i> Installation Applet</b>”);
setSize(new Dimension(512,300));
messagesArea.setForeground(Color.blue);
messagesArea.setEditable(false);
messagesArea.setText(“Installation started..\n”);
getContentPane().add(titleLabel, BorderLayout.NORTH);
getContentPane().add(new JScrollPane(messagesArea,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)
, BorderLayout.CENTER);
}
/**Start the applet*/
public void start() {
int choice = JOptionPane.showConfirmDialog(this,
“This will Install “+
getParameter(“appname”)+
“ on your computer”,
Search WWH ::




Custom Search