文档介绍:×÷Õߣºdiego lynn
ÈÕÆÚ£º2001-3-25 10:55:47
JNLP API Examples
The JNLP API is designed to provide additional information to the application that would otherwise not be available using the standard Java 2 SE API. The following code examples show how the following services can be used: BasicService, ClipboardService, DownloadService, FileOpenService, FileSaveService, PrintService, and PersistenceService.
The public classes and interfaces in the JNLP API are included in the file. This JAR file must be included in the classpath piling source files that use the JNLP API. For example (on Windows):
javac -classpath .; *.java
The file is included in the JNLP Developers Pack .
Using a BasicService Service
The service provides a set of methods for querying and interacting with the environment similar to what the AppletContext provides for a Java Applet.
The showURL method uses the JNLP API to direct the default browser on the platform to show the given URL. The method returns true if the request esses, otherwise false.
import .*;
...
// Method to show a URL
boolean showURL(URL url) {
try {
// Lookup the object
BasicService bs = (BasicService)("");
// Invoke the showDocument method
return (url);
} catch(UnavailableServiceExcepti