Java Reference
In-Depth Information
else
else
program
=
prog
;
Container cp
=
getContentPane
();
cp
.
setLayout
(
new
new
FlowLayout
());
JButton b
;
cp
.
add
(
b
=
new
new
JButton
(
"Exec"
));
b
.
addActionListener
(
new
new
ActionListener
() {
public
public
void
void
actionPerformed
(
ActionEvent evt
) {
runProg
();
}
});
cp
.
add
(
b
=
new
new
JButton
(
"Wait"
));
b
.
addActionListener
(
new
new
ActionListener
() {
public
public
void
void
actionPerformed
(
ActionEvent evt
) {
doWait
();
}
});
cp
.
add
(
b
=
new
new
JButton
(
"Exit"
));
b
.
addActionListener
(
new
new
ActionListener
() {
public
public
void
void
actionPerformed
(
ActionEvent evt
) {
System
.
exit
(
0
);
}
});
pack
();
}
/** Start the help, in its own Thread. */
public
public
void
void
runProg
() {
new
new
Thread
() {
public
public
void
void
run
() {
try
try
{
// Get the URL for the Help File
URL helpURL
=
this
this
.
getClass
().
getClassLoader
().
getResource
(
HELPFILE
);
// Start Netscape from the Java Application.
pStack
.
push
(
Runtime
.
getRuntime
().
exec
(
program
+
" "
+
helpURL
));
Debug
.
println
(
"trace"
,
"In main after exec "
+
pStack
.
size
());
}
catch
catch
(
Exception ex
) {
JOptionPane
.
showMessageDialog
(
ExecDemoNS
.
this
,