Hi Christopher,
When I replace the old version DJNativeSwing-SWT-0-9-9-20101023 with the latest version DJNativeSwing-SWT-0-9-9-20101112, but a strange thing happen.
See the code as follows, I can see the Swing GUI when I run the program, but when I used the latest version, I cannot see the Swing Interface and it didn't throw any exception or error :
import java.awt.BorderLayout;
import javax.swing.JPanel;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.View;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
public class SimpleWebBrowserExample extends SingleFrameApplication {
public static void main(final String[] args) {
Application.launch(SimpleWebBrowserExample.class, args);
}
/* (non-Javadoc) * @see org.jdesktop.application.Application#startup() */ @Override protected void startup() { NativeInterface.open(); View view = getMainView(); final JWebBrowser webBrowser = new JWebBrowser(); webBrowser.navigate("http://www.google.com"); view.setComponent(new JPanel(new BorderLayout())); view.getComponent().add(webBrowser, BorderLayout.CENTER); NativeInterface.runEventPump(); show(view); }
}
There is a bug in your code:
"NativeInterface.runEventPump();" must be the last call of your method, because it is a blocking call.
If startup() must return, then don't call that "runEventPump" method but it will only work on Windows and Linux (not Mac) where calling this method is optional.
Hope this helps,
-Christopher