Java Reference
In-Depth Information
Q I have written an applet that I want to make available using Java Web Start.
Should I convert it to an application or go ahead and run it as is?
A
If you would be converting your program to an application simply to run it with
Web Start, that's probably not necessary. The purpose of the
applet-desc
tag is to
make it possible to run applets without modification in Java Web Start. The only
reason to undertake the conversion is if there are other things you want to change
about your program, such as the switch from
init()
to a constructor method.
Q How can I make sure that a
SwingWorker
object has finished work?
A
Call the worker's
isDone()
method, which returns
true
when the task has finished
execution.
Take note that this method returns
true
no matter how the task completes, so if it
was canceled, interrupted, or failed in some other manner, it will return
true
.
The
isCancelled()
method can be used to check whether the task was canceled.
Review today's material by taking this three-question quiz.
Questions
1.
What interface must be implemented to be notified when a
SwingWorker
has fin-
ished execution?
a.
ActionListener
b.
PropertyChangeListener
c.
SwingListener
2.
Which XML element is used to identify the name, author, and other details about a
Java Web Start-run application?
a.
jnlp
b.
information
c.
resources
3.
What security restrictions apply to a Java Web Start application?
a.
The same restrictions in place for applets
b.
The same restrictions in place for applications
c.
The restrictions chosen by the user