public class AppletLauncher extends Object
Applet
s.
An applet can be launched by passing its type as String
, the actual type, or an instance of the
applet to launch:
AppletViewer
viewer = AppletLauncher.applet
("org.fest.swing.applet.MyApplet").start
(); // orAppletViewer
viewer = AppletLauncher.applet
(MyApplet.class).start
(); // orAppletViewer
viewer = AppletLauncher.applet
(new MyApplet()).start
();
In addition, we can pass parameters to the applet to launch. The parameters to pass are the same that are specified in the HTML "param" tag:
AppletViewer
viewer = AppletLauncher.applet
(new MyApplet()) .withParameters
(name
("bgcolor").value
("blue"),name
("color").value
("red"),name
("pause").value
("200") ) .start
(); // or Map<String, String> parameters = new HashMap<String, String>(); parameters.put("bgcolor", "blue"); parameters.put("color", "red"); parameters.put("pause", "200");AppletViewer
viewer = AppletLauncher.applet
(new MyApplet()).withParameters
(parameters).start
();
Modifier and Type | Method and Description |
---|---|
static AppletLauncher |
applet(Applet applet)
Creates a new applet launcher.
|
static AppletLauncher |
applet(Class<? extends Applet> appletType)
Creates a new applet launcher.
|
static AppletLauncher |
applet(String appletType)
Creates a new applet launcher.
|
AppletViewer |
start()
Launches the applet in a
(using implementations of
and . |
AppletLauncher |
withParameters(AppletParameter... newParameters)
Sets the parameters for the applet to launch, as an alternative to
. |
AppletLauncher |
withParameters(Map<String,String> newParameters)
Sets the parameters for the applet to launch, as an alternative to
. |
@RunsInEDT public static AppletLauncher applet(String appletType)
appletType
- the type of applet to instantiate.NullPointerException
- if the given type name is null
.IllegalArgumentException
- if the given type name is empty.IllegalArgumentException
- if the given type is not a subclass of java.applet.Applet
.UnexpectedException
- if the given type cannot be loaded.UnexpectedException
- if a new instance of the given type cannot be instantiated.@RunsInEDT public static AppletLauncher applet(Class<? extends Applet> appletType)
appletType
- the type of applet to instantiate.NullPointerException
- if the given type is null
.UnexpectedException
- if a new instance of the given type cannot be instantiated.public static AppletLauncher applet(Applet applet)
applet
- the applet to launch.NullPointerException
- if the given applet is null
.public AppletLauncher withParameters(Map<String,String> newParameters)
withParameters(AppletParameter...)
.newParameters
- the parameters for the applet to launch.NullPointerException
- if newParameters
is null
.public AppletLauncher withParameters(AppletParameter... newParameters)
withParameters(Map)
.newParameters
- the parameters for the applet to launch.NullPointerException
- if newParameters
is null
.NullPointerException
- if any parameter is null
.public AppletViewer start()
AppletViewer
(using implementations of
BasicAppletStub
and BasicAppletContext
. To provide your own
AppletStub
create a new AppletViewer
directly.
The AppletViewer
is created and launched in the event dispatch thread.AppletViewer
.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.