chrriis.dj.nativeswing.swtimpl
Class NativeInterfaceAppletHandler

java.lang.Object
  extended by chrriis.dj.nativeswing.swtimpl.NativeInterfaceAppletHandler

public class NativeInterfaceAppletHandler
extends Object

A special helper that allows Native Swing to work in a JApplet.

Here is how to use it:

1. Add a static initializer at the top of the JApplet subclass:

static {
  NativeInterfaceAppletHandler.activateAppletMode();
}

2. Override all applet lifecycle methods to call a corresponding method of the NativeInterfaceAppletHandler as the first statement.
public void init() {
  NativeInterfaceAppletHandler.init(this);
  // Rest of init().
}
public void start() {
  NativeInterfaceAppletHandler.start(this);
  // Rest of start().
}
public void stop() {
  NativeInterfaceAppletHandler.stop(this);
  // Rest of stop().
}
public void destroy() {
  NativeInterfaceAppletHandler.destroy(this);
  // Rest of destroy().
}

3. Open the interface explicitly.
While the methods of this class do close the interface and reopen it when re-starting if it was previously open, it does not automatically open it. In most cases, one would probably change the start() method like this:
public void start() {
  NativeInterfaceAppletHandler.start(this);
  NativeInterface.open();
  // Rest of start().
}

Author:
Christopher Deckers

Method Summary
static void activateAppletMode()
           
static void destroy(Applet applet)
           
static void init(Applet applet)
           
static void start(Applet applet)
           
static void stop(Applet applet)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

activateAppletMode

public static void activateAppletMode()

init

public static void init(Applet applet)

start

public static void start(Applet applet)

stop

public static void stop(Applet applet)

destroy

public static void destroy(Applet applet)