Java Reference
In-Depth Information
line 31 has been sketched to keep the listing simple. In other examples, you can see how to
obtain that value from the BasicService JNLP runtime object (see Chapter 11).
At line 140, a fake delay has been added in order to see the effect of the resources being down-
loaded, one after the other, in a local development environment. In real-world cases, always
use line 141 for synchronizing threads, instead.
The processJar() method is included only for demonstration. Depending on your needs, you
can modify it or even remove it, as needed. One important thing to see here is how runtime
services are obtained by applications.
In lines 109-110, for example, an ExtensionInstallerService object is obtained, requesting
its fully qualified name string to the ServiceManager and casting the resulting Object to the
needed service class, as in the following lines of code:
extensionInstaller =
(ExtensionInstallerService)ServiceManager.lookup(“javax.jnlp.ExtensionInstaller
Service”);
By means of this service, it is possible, among other things, to hide JNLP Client's status win-
dow, as of line 112.
8
The launched application (see Listing 8.10) is much more simple than the installer class. It is a
mere example of an application. It uses a resource contained in one of the JAR files down-
loaded by the Splash class, and nothing else.
L ISTING 8.10 The App class
package com.marinilli.b2.c8.splash;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/**
* Chapter 8 - An Application installed by the Splash class
* @author Mauro Marinilli
* @version 1.0
*/
public class App extends JFrame {
public App() {
ImageIcon img =
new ImageIcon(getClass().getClassLoader().getResource(“back.jpg”));
JLabel aLabel = new JLabel(img);
Search WWH ::




Custom Search