Solved

Problem opening new window with SWT browser in swing JFrame

Posted on 2013-02-04
1
1,077 Views
Last Modified: 2013-02-24
hello.
i am using SWT browser widget in swing Jframe application.
like this


      display = new Display();
             Shell shell = SWT_AWT.new_Shell(display, canvas);
             shell.setLayout(new FillLayout());
         browser = new Browser(shell, SWT.NONE);
         boolean rc = browser.setUrl("http://www.yahoo.com");
             shell.setSize(canvas.getWidth(), canvas.getHeight());
             shell.pack();
             while (!shell.isDisposed()) {
              if (!display.readAndDispatch()) {
               display.sleep();
              }
             }



I have a problem when clicking on links that would open in a new window.
(target="blank")
my app ignored click, react nothing.

Instead of opening those pages in my app,
my system default browser(IE) opens those URL.

Im thinking about using "browser.addOpenWindowListener".
but i dont know how to solve it.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=57068#c2
he seems having same problem...but his solution doesnot work for mine.

any help would appreciated.
0
Comment
Question by:HFunakawa
1 Comment
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 38859003
This link, http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTBrowserExample.htm contains an example of using the addOpenWindowListener. You should be able to use this information to implement your own solution.

Let me know if you require further help!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question