Solved

Problem opening new window with SWT browser in swing JFrame

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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…

747 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

10 Experts available now in Live!

Get 1:1 Help Now