Deprecated
as a consequence of Applet and AppletStub being deprecated. See corresponding docs for further information.
The AppletLoader enables deployment of LWJGL to applets in an easy and polished way. The loader will display a configurable logo and progressbar while the relevant jars (generic and native) are downloaded from a specified source.
The downloaded jars are extracted to the users temporary directory - and if enabled, cached for faster loading in future uses.
The following applet parameters are required:
Additionally the following parameters can be supplied to tweak the behaviour of the AppletLoader.
| Modifier and Type | Field and Description |
|---|---|
| protected Thread | animationThread
animation thread that renders our load screen while loading |
| protected Color | bgColor
background color of applet |
| protected boolean | cacheEnabled
whether to use caching system, only download files that have changed |
| protected boolean | certificateRefused
whether a certificate refused error occurred |
| protected String[] | certificateRefusedMessage
error message to display if user refuses to accept certificate |
| protected ClassLoader | classLoader
classLoader used to add downloaded jars to the classpath |
| protected int | concurrentLookupThreads
threads to use when fetching information of files to be downloaded |
| protected int | currentSizeExtract
current size of extracted in bytes |
| protected boolean | debugMode
whether we're running in debug mode |
| protected String[] | errorMessage
fatal error message to display |
| protected boolean | fatalError
whether a fatal error occurred |
| protected Color | fgColor
color to write foreground in |
| protected int[] | fileSizes
Sizes of files to download |
| protected HashMap | filesLastModified
Used to store file names with lastModified time |
| protected String[] | genericErrorMessage
generic error message to display on error |
| protected boolean | headless
whether to run in headless mode |
| protected String[] | headlessMessage
messages to be passed via liveconnect in headless mode |
| protected boolean | headlessWaiting
whether to switch applets in headless mode or wait longer |
| protected Thread | loaderThread
actual thread that does the loading |
| protected Image | logo
logo to be shown while loading |
| protected Image | logoBuffer
logo to be shown while loading |
| protected Applet | lwjglApplet
applet to load after all downloads are complete |
| protected boolean | lzmaSupported
whether lzma is supported |
| protected String[] | minimumJREMessage
error message to display if minimum JRE version is not met |
| protected boolean | minimumJreNotFound
whether the minimum required JRE version is not found |
| protected int | nativeJarCount
Number of native jars |
| protected static boolean | natives_loaded
have natives been loaded by another instance of this applet |
| protected Image | offscreen
offscreen image used |
| protected boolean | pack200Supported
whether pack200 is supported |
| protected boolean | painting
set to true while painting is done |
| protected volatile int | percentage
used to calculate length of progress bar |
| protected boolean | prependHost
whether to prepend host to cache path |
| protected Image | progressbar
progressbar to render while loading |
| protected Image | progressbarBuffer
progressbar to render while loading |
| protected volatile int | state
state of applet loader |
| public static final int | STATE_CHECK_JRE_VERSION
checking version of jre |
| public static final int | STATE_CHECKING_CACHE
checking for already downloaded files |
| public static final int | STATE_CHECKING_FOR_UPDATES
checking if any updates are available for cache files |
| public static final int | STATE_DETERMINING_PACKAGES
determining which packages that are required |
| public static final int | STATE_DONE
done |
| public static final int | STATE_DOWNLOADING
downloading packages |
| public static final int | STATE_EXTRACTING_PACKAGES
extracting packages |
| public static final int | STATE_INIT
initializing |
| public static final int | STATE_INITIALIZE_REAL_APPLET
initializing real applet |
| public static final int | STATE_START_REAL_APPLET
stating real applet |
| public static final int | STATE_SWITCHING_APPLET
switching to real applet |
| public static final int | STATE_UPDATING_CLASSPATH
updating the classpath |
| public static final int | STATE_VALIDATING_PACKAGES
validating packages |
| protected String | subtaskMessage
String to display as a subtask |
| protected int | totalDownloadSize
total size of download in bytes |
| protected int | totalSizeExtract
total size of extracted in bytes |
| protected URL[] | urlList
urls of the jars to download |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | appletResize(int
the new requested width for the applet width, int the new requested height for the applet height)Implements java. |
| protected static boolean | Returns: true if the certificate chains are the samefirst chain of certificates certs1, Certificate[] second chain of certificates certs2)Compare two certificate chains to see if they match |
| protected void | |
| protected boolean | Returns: returns true if the version in file matches specified version- location to file containing version information versionFile, String - String version that needs to be compared version)This method will return true if the version stored in the file matches the supplied String version. |
| protected void | debug_sleep(long
milliseconds to sleep ms)Utility method for sleeping Will only really sleep if debug has been enabled |
| public void | destroy()
Overrides java. |
| protected void | downloadJars(String
location of the directory to save to path)Will download the jars from the server using the list of urls in urlList, while at the same time updating progress bar |
| protected void | extractGZip(String
Input path to pack file in, String output path to resulting file out)Extract GZip File |
| protected void | |
| protected void | extractLZMA(String
Input path to pack file in, String output path to resulting file out)Extract LZMA File |
| protected void | extractNatives(String
base folder containing all downloaded jars path)This method will extract all file from the native jar and extract them to the subdirectory called "natives" in the local path, will also check to see if the native jar files is signed properly |
| protected void | extractPack(String
Input path to pack file in, String output path to resulting file out)Extract Pack File |
| protected void | fatalErrorOccured(String
Error message to print error, Exception e)Sets the error message and print debug information |
| private static String | Returns: Stacktrace of exception in the form of a stringException to make stacktrace of exception)Generates a stacktrace in the form of a string |
| public Applet | |
| protected boolean | Returns: value of parameter or defaultValueName of parameter name, boolean default value to return if no such parameter defaultValue)Retrieves the boolean value for the parameter |
| protected String | Returns: path to applets cache directoryThis method will return the location of the cache directory. |
| protected Color | |
| protected static Certificate[] | Returns: - certificate chain of AppletLoaderReturns the current certificate chain of the AppletLoader |
| protected String | |
| protected String | Returns: file name as stringGet file name from this url url)Get file name portion of URL. |
| protected Image | |
| public Image | Returns: the Image filelocation of the image url)Overrides java. |
| protected int | Returns: value of parameter or defaultValueName of parameter name, int default value to return if no such parameter defaultValue)Retrieves the int value for the applet |
| protected void | getJarInfo(File
- location to read cache file from dir)This method will get the files sizes of the files to download. |
| protected InputStream | Returns: InputStream or null if not possibleconnection to get input stream from urlconnection)Retrieves a jar files input stream. |
| protected String | Returns: file name as stringGet jar file name from this url url)Get jar name from URL. |
| protected String | |
| public String[] | |
| public int | getStatus()
Retrieves the current status of the AppletLoader and is used by liveconnect when running in headless mode. |
| protected String | Returns: value of parameter or defaultValueName of parameter name, String default value to return if no such parameter defaultValue)Retrieves the String value for the parameter |
| public boolean | imageUpdate(Image
the image being observed img, int see flag, int imageUpdate for more informationthe x coordinate x, int the y coordinate y, int the width width, int the height height)Overrides java. Implements java. |
| public void | init()
Overrides java. |
| public boolean | Returns: returns true if the available version is greater or equal to the minimum version requiredWhen this method is supplied with a JRE version it will compare it to the current JRE version. |
| protected boolean | Returns: boolean - runs false if the file is corrupt- zip file to test file)This method will check if a zip file is valid by running through it and checking for any corruption and CRC failures |
| protected void | loadJarURLs()
Reads list of jars to download and adds the urls to urlList also finds out which OS you are on and adds appropriate native jar to the urlList |
| public void | paint(Graphics
the specified Graphics window g)Overrides java. |
| protected HashMap | Returns: the hashmap stored in the file or an empty hashmap if it failsthe file to read file)read the HashMap from File |
| protected Object | Returns: the object contained in the file or null if it failsthe file to read file)read the object from the File |
| protected String | Returns: the String stored in the file or null if it failsto be read file)read String object from File |
| public String | Returns: - return the modified string, if target substring not found return original string- String to search original, String - substring to find target, String - what to replace target substring with replacement)Replaces the last occurrence of the specified target substring with the specified replacement string in a string. |
| public void | run()
Implements java. |
| protected void | setLWJGLProperties()
Parses the java_arguments list and sets lwjgl specific properties accordingly, before the launch. |
| protected void | |
| protected void | |
| public void | start()
Overrides java. |
| public void | stop()
Overrides java. |
| protected void | switchApplet()
replace the current applet with the lwjgl applet using AppletStub and initialise and start it |
| protected String | Returns: trimmed string based on capabilities of clientstring of files to be trimmed file)Trims the passed file string based on the available capabilities |
| private void | unloadNatives(String
directory where natives are stored nativePath)Unload natives loaded by a different classloader. |
| public final void | update(Graphics
the specified Graphics window g)Overrides java. |
| protected void | updateClassPath(final String
location where applet is stored path)Edits the ClassPath at runtime to include the jars that have just been downloaded and then adds the lwjgl natives folder property. |
| protected void | validateJars(String
- where the jars are stored path)Check and validate jars which will be loaded into the classloader to make sure that they are not corrupt. |
| protected void | writeObjectFile(File
the file to write out to file, Object the contents of the file object)write object to specified File |