Package net.sourceforge.jnlp.runtime
Class AppletEnvironment
- java.lang.Object
-
- net.sourceforge.jnlp.runtime.AppletEnvironment
-
- All Implemented Interfaces:
java.applet.AppletContext,java.applet.AppletStub
public class AppletEnvironment extends java.lang.Object implements java.applet.AppletContext, java.applet.AppletStubThe applet environment including stub, context, and frame. The default environment puts the applet in a non-resizable frame; this can be changed by obtaining the frame and setting it resizable.- Version:
- $Revision: 1.12 $
-
-
Field Summary
Fields Modifier and Type Field Description private java.applet.Appletappletthe appletprivate booleanappletStartedwhether the applet has been started / displayedprivate java.awt.Containercontthe applet containerprivate booleandestroyedwhether the applet has been destroyedprivate JNLPFilefilethe JNLP fileprivate static LoggerLOGprivate java.util.Map<java.lang.String,java.lang.String>parametersthe parametersprivate WeakList<AppletAudioClip>weakClipsweak references to the audio clips
-
Constructor Summary
Constructors Constructor Description AppletEnvironment(JNLPFile file, AppletInstance appletInstance)Create a new applet environment for the applet specified by the JNLP file, in a new frame.AppletEnvironment(JNLPFile file, AppletInstance appletInstance, java.awt.Container cont)Create a new applet environment for the applet specified by the JNLP file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappletResize(int width, int height)private voidcheckDestroyed()Checks whether the applet has been destroyed, and throws an IllegalStateException if the applet has been destroyed of.voiddestroy()Disposes the applet's resources and disables the applet environment from further use; after calling this method the applet stub and context methods throw IllegalStateExceptions.java.applet.AppletgetApplet(java.lang.String name)Returns the applet if the applet's name is specified, otherwise return null.java.applet.AppletContextgetAppletContext()java.awt.ContainergetAppletFrame()java.util.Enumeration<java.applet.Applet>getApplets()Returns an enumeration that contains only the applet from the JNLP file.java.applet.AudioClipgetAudioClip(java.net.URL location)java.net.URLgetCodeBase()java.net.URLgetDocumentBase()java.awt.ImagegetImage(java.net.URL location)java.lang.StringgetParameter(java.lang.String name)java.io.InputStreamgetStream(java.lang.String key)Required for JRE1.4, but not implemented yet.java.util.Iterator<java.lang.String>getStreamKeys()Required for JRE1.4, but not implemented yet.booleanisActive()voidsetApplet(java.applet.Applet applet)Set the applet of this environment; can only be called once.voidsetStream(java.lang.String key, java.io.InputStream stream)Required for JRE1.4, but not implemented yet.voidshowDocument(java.net.URL uRL)voidshowDocument(java.net.URL uRL, java.lang.String str)Not implemented yet.voidshowStatus(java.lang.String str)Not implemented yet.voidstartApplet()Initialize, start, and show the applet.
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
file
private JNLPFile file
the JNLP file
-
applet
private java.applet.Applet applet
the applet
-
parameters
private java.util.Map<java.lang.String,java.lang.String> parameters
the parameters
-
cont
private java.awt.Container cont
the applet container
-
weakClips
private final WeakList<AppletAudioClip> weakClips
weak references to the audio clips
-
appletStarted
private boolean appletStarted
whether the applet has been started / displayed
-
destroyed
private boolean destroyed
whether the applet has been destroyed
-
-
Constructor Detail
-
AppletEnvironment
public AppletEnvironment(JNLPFile file, AppletInstance appletInstance, java.awt.Container cont)
Create a new applet environment for the applet specified by the JNLP file.- Parameters:
file- jnlp file base to construct environmentappletInstance- applet for this environmentcont- container to place this applet to
-
AppletEnvironment
public AppletEnvironment(JNLPFile file, AppletInstance appletInstance)
Create a new applet environment for the applet specified by the JNLP file, in a new frame.- Parameters:
file- jnlp file base to construct environmentappletInstance- applet for this environment
-
-
Method Detail
-
checkDestroyed
private void checkDestroyed()
Checks whether the applet has been destroyed, and throws an IllegalStateException if the applet has been destroyed of.- Throws:
java.lang.IllegalStateException
-
destroy
public void destroy()
Disposes the applet's resources and disables the applet environment from further use; after calling this method the applet stub and context methods throw IllegalStateExceptions.
-
getAppletFrame
public java.awt.Container getAppletFrame()
- Returns:
- the frame that contains the applet. Disposing this frame will destroy the applet.
-
startApplet
public void startApplet()
Initialize, start, and show the applet.
-
getApplet
public java.applet.Applet getApplet(java.lang.String name)
Returns the applet if the applet's name is specified, otherwise return null.- Specified by:
getAppletin interfacejava.applet.AppletContext
-
setApplet
public void setApplet(java.applet.Applet applet)
Set the applet of this environment; can only be called once.- Parameters:
applet- source of this environment
-
getApplets
public java.util.Enumeration<java.applet.Applet> getApplets()
Returns an enumeration that contains only the applet from the JNLP file.- Specified by:
getAppletsin interfacejava.applet.AppletContext
-
getAudioClip
public java.applet.AudioClip getAudioClip(java.net.URL location)
- Specified by:
getAudioClipin interfacejava.applet.AppletContext- Parameters:
location- source of clip- Returns:
- an audio clip.
-
getImage
public java.awt.Image getImage(java.net.URL location)
- Specified by:
getImagein interfacejava.applet.AppletContext- Parameters:
location- location of image- Returns:
- an image loaded from the specified location.
-
showDocument
public void showDocument(java.net.URL uRL)
- Specified by:
showDocumentin interfacejava.applet.AppletContext- Parameters:
uRL- url of document
-
showDocument
public void showDocument(java.net.URL uRL, java.lang.String str)Not implemented yet.- Specified by:
showDocumentin interfacejava.applet.AppletContext- Parameters:
uRL- source of documentstr- _self, _parent, _top, _blank or "name". Have sense only for applets. Not implemented for our javaws world
-
showStatus
public void showStatus(java.lang.String str)
Not implemented yet.- Specified by:
showStatusin interfacejava.applet.AppletContext- Parameters:
str- id of applet
-
setStream
public void setStream(java.lang.String key, java.io.InputStream stream)Required for JRE1.4, but not implemented yet.- Specified by:
setStreamin interfacejava.applet.AppletContext
-
getStream
public java.io.InputStream getStream(java.lang.String key)
Required for JRE1.4, but not implemented yet.- Specified by:
getStreamin interfacejava.applet.AppletContext
-
getStreamKeys
public java.util.Iterator<java.lang.String> getStreamKeys()
Required for JRE1.4, but not implemented yet.- Specified by:
getStreamKeysin interfacejava.applet.AppletContext
-
appletResize
public void appletResize(int width, int height)- Specified by:
appletResizein interfacejava.applet.AppletStub
-
getAppletContext
public java.applet.AppletContext getAppletContext()
- Specified by:
getAppletContextin interfacejava.applet.AppletStub
-
getCodeBase
public java.net.URL getCodeBase()
- Specified by:
getCodeBasein interfacejava.applet.AppletStub
-
getDocumentBase
public java.net.URL getDocumentBase()
- Specified by:
getDocumentBasein interfacejava.applet.AppletStub
-
getParameter
public java.lang.String getParameter(java.lang.String name)
- Specified by:
getParameterin interfacejava.applet.AppletStub
-
isActive
public boolean isActive()
- Specified by:
isActivein interfacejava.applet.AppletStub
-
-