Link to home
Create AccountLog in
Avatar of ionutcib
ionutcibFlag for Romania

asked on

How can I integrate swt browser into my SWING application?

How can I integrate SWT browser into my SWING application?
Avatar of isprabu
isprabu

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

ASKER CERTIFIED SOLUTION
Avatar of isprabu
isprabu

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of ionutcib

ASKER

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