Solved

Problem opening new window with SWT browser in swing JFrame

Posted on 2013-02-04
1
1,073 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now