How can I integrate swt browser into my SWING application?

ionutcib
ionutcib used Ask the Experts™
on
How can I integrate SWT browser into my SWING application?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
SWT itself is a GUI library like Swing. And SWT Browser is part of the SWT library. Unlike Swing, SWT is platform specific (ex; Windows).
So, why don't you use SWT for the your GUI development too?
I have given below a raw sample code using SWT only here. Hope this might be useful OR pardon me if you already knew this....

hope this helps!
public static void main(String [] args) { 
            Display display = new Display(); 
		//create a SWT window
            Shell shell = new Shell(display); 
            shell.setLayout(new  
	    FillLayout()); 
		//create the browser 
            WebKitBrowser browser= new WebKitBrowser(shell, SWT.NONE); 
            browser.setUrl(<home page URL here>); 
            shell.open(); 
            while (!shell.isDisposed()) { 					 
                if (!display.readAndDispatch())
                    display.sleep(); 
            }
       }

Open in new window

Author

Commented:
I already have an application in swing and it will be difficult to translate all in swt now(or it will not?)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial