Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to embed SWT browser in swing jframe

I want to embed my SWT browser in swing jframe. I try sample, but it need to resize the window to load browser window. what can I do to repaint the canvas, with out resizing?

like image 619
user3813088 Avatar asked Jul 16 '14 13:07

user3813088


1 Answers

Here is a working example on GIT showing how to embed SWT in a traditional Swing JPanel: https://gist.github.com/caprica/6890618 (Text version: here)

The trick is to create a java.awt.Canvas linked to an SWT shell. This canvas can be added to any tradionnal Swing component. The SWT shell loop is managed by a separate thread.

Here is a screenshot on my Windows 7 box with Java 7: enter image description here

like image 190
Stephan Avatar answered Oct 19 '22 04:10

Stephan