Hi,
See issue# 82134. As far as I have seen, if you place the browserCanvas
in a JPanel or
JFrame without them being visible, you will get an
assertion as you have. I would add the following two lines before the
navigation.loadUrl() method.
In future case, my suggestion would be to follow the EmbeddedWindow
example as closely as possible.
It will save you a lot of time and grief!
Good Luck!
-Jeet
------------
add(m_browserCanvas, BorderLayout.CENTER);
-->this.show();
-->this.front();
////////////////////////////////////////////////////////////////
System.out.println("== loadURL ==" + m_navigation);
m_navigation.loadURL("http://localhost");//Crash here
jmi wrote:
> When I use the Frame release, I have the next message - an error occurs
> while using the navigation. What's happens????
>
> MESSAGES:
>
> ==========
>
> native library does implement webclient.Navigation
>
> native library does implement webclient.WindowControl
>
> Creating Event Queue
>
> InitMozillaStuff(9546810): Create the action queue
>
> Init the baseWindow
>
> Create the BaseWindow...
>
> Creation Done.....
>
> Show the webBrowser
>
> == loadURL ==org.mozilla.webclient.wrapper_native.NavigationImpl@559d3c
>
> org.mozilla.util.AssertionFailureException
>
> at org.mozilla.util.Assert.assert_it(Assert.java:122)
>
> at
> org.mozilla.webclient.wrapper_native.NavigationImpl.loadURL(NavigationImpl.j
> ava:83)
>
> at com.id.pyrites.Frame1.jbInit(Frame1.java:51)
>
> at com.id.pyrites.Frame1.<init>(Frame1.java:20)
>
> at IdPyritesC.setMainScreen(IdPyritesC.java:1519)
>
> at IdPyritesC.access$6000171(IdPyritesC.java:99)
>
> at IdPyritesC$8.actionPerformed(IdPyritesC.java:857)
>
> at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>
> at
> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown
> Source)
>
> at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
> Source)
>
> at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>
> at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
> Source)
>
> at java.awt.Component.processMouseEvent(Unknown Source)
>
> at java.awt.Component.processEvent(Unknown Source)
>
> at java.awt.Container.processEvent(Unknown Source)
>
> at java.awt.Component.dispatchEventImpl(Unknown Source)
>
> at java.awt.Container.dispatchEventImpl(Unknown Source)
>
> at java.awt.Component.dispatchEvent(Unknown Source)
>
> at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
>
> at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
>
> at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
>
> at java.awt.Container.dispatchEventImpl(Unknown Source)
>
> at java.awt.Window.dispatchEventImpl(Unknown Source)
>
> at java.awt.Component.dispatchEvent(Unknown Source)
>
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
>
> at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
>
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>
> at java.awt.EventDispatchThread.run(Unknown Source)
>
>
>
> CODE
>
> ======
>
> package com.id.pyrites;
>
>
>
> import java.awt.*;
>
> import org.mozilla.util.Assert;
>
> import org.mozilla.webclient.BrowserControlCanvas;
>
> import org.mozilla.webclient.BrowserControl;
>
> import org.mozilla.webclient.BrowserControlFactory;
>
>
>
> import org.mozilla.webclient.Navigation;
>
>
>
> public class Frame1 extends Frame {
>
> BorderLayout borderLayout1 = new BorderLayout();
>
> private BrowserControl m_browserControl;
>
> private BrowserControlCanvas m_browserCanvas;
>
> private Navigation m_navigation = null;
>
>
>
> public Frame1() {
>
> super();
>
> try {
>
> jbInit();
>
> }
>
> catch (Exception e) {
>
> e.printStackTrace();
>
> }
>
> }
>
>
>
> private void jbInit() throws Exception {
>
> this.setLayout(borderLayout1);
>
> this.setSize(new Dimension(400, 300));
>
> this.setTitle("Test Browser AWT FRAME");
>
> this.setBackground(SystemColor.control);
>
> this.setVisible(true);
>
>
>
> String binDir = "C:\\Program Files\\mozilla";
>
> // Create the browser
>
> try {
>
> BrowserControlFactory.setAppData(binDir);
>
> m_browserControl = BrowserControlFactory.newBrowserControl();
>
> m_browserCanvas = (BrowserControlCanvas)
> m_browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
>
> m_navigation = (Navigation)
> m_browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
>
> if(null == m_navigation) System.out.println("m_navigation is null");
>
> }
>
> catch(Exception e) {
>
> System.out.println("Can't create BrowserControl: " + e.getMessage());
>
> }
>
> add(m_browserCanvas, BorderLayout.CENTER);
>
>
>
> ////////////////////////////////////////////////////////////////
>
> System.out.println("== loadURL ==" + m_navigation);
>
> m_navigation.loadURL("http://localhost");//Crash here
>
> System.out.println("== loadURL OK ==");
>
> }
>
> }
>
>
>
>
>