This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
1 Replies Last post: Apr 16, 2007 1:54 PM by Vladimir Ikryanov  
suvarna   17 posts since
Oct 13, 2006
Currently Being Moderated

Apr 13, 2007 12:40 PM

Dialogs Issue

Hi All,

 

I am facing very peculiar problem with jexlorer dialogs/alerts. I have the code to handle the dialogs, which doesn't require

manual click on the dialog buttons. But the code works fine in one machine and doesn't work in the other. Both the

machines have windows xp professional installed with service pack 2. But only difference is, both the machines are

in different networks. I am using jexplorer 7.1. Tried the code even with jexplorer 8, but dialogs issue still remains.

I have pasted the code below to handle dialogs for reference.

 

Let me know what might be the problem for this different behaviors on different boxes.

Sample code.....

import com.jniwrapper.win32.ie.Browser;

import com.jniwrapper.win32.ie.WebBrowser;

import com.jniwrapper.win32.ie.event.BrowserDialogEventHandler;

import com.jniwrapper.win32.ie.dom.HTMLElement;

import com.jniwrapper.win32.ui.MessageBox;

import com.jniwrapper.win32.ui.Wnd;

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;

import javax.swing.JFrame;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.UIManager;

import java.awt.BorderLayout;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

 

public class AlertHandlingSample

{

    private static final String HTML_CONTENT =

            "" + "";

    public static void main(String[] args) throws Exception

    {

        UIManager.setLookAndFeel(WindowsLookAndFeel.class.getName());

        JFrame frame = new JFrame("JExplorer - Child Browser Sample");

        frame.setSize(800, 600);

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.setLocationRelativeTo(null);

        Browser browser = new Browser();

        browser.setContent(HTML_CONTENT);

        JPanel panel = new JPanel();

        // set layout

        panel.setLayout(new BorderLayout());

        panel.add(browser, BorderLayout.CENTER);

        frame.getContentPane().add(panel);

        frame.setVisible(true);

        browser.waitReady();

        //Code to handle the alert

        //Comment this portion of code and test it and then uncommnet and test

        /*browser.setDialogEventHandler(new BrowserDialogEventHandler()

       {

           public int showDialog(Wnd wnd, String title, String text, int type)

           {

               System.out.println("inside the method");

               // clicks the OK button on the alert dialog

                    return MessageBox.IDOK;

           }

       });*/

        final HTMLElement element = (HTMLElement)browser.getDocument().getElementById("theLink");

        element.click();

    }

 

}

Thanks in advance.

Suvarna

Vladimir Ikryanov TeamDev Ltd. 404 posts since
Apr 24, 2006
Currently Being Moderated
1. Apr 16, 2007 1:54 PM in response to: suvarna
Re: Dialogs Issue

Hello Suvarna,

 

Could you please specify what exactly doesnÂ’t work on the other machine? Did you receive the showDialog event? Also please make sure Internet Explorer version on these machines the same.

 

Regards,

Vladimir

More Like This

  • Retrieving data ...