Showing posts with label Embedded Frame. Show all posts
Showing posts with label Embedded Frame. Show all posts

Thursday, May 14, 2009

How to embed Swing control inside SWT Composite?

You need an SWT_AWT bridge to create WEmbeddedFrame which will be used to add Swing Controls.

Here is sample code that adds JLabel to AWT frame.

JLabel label = new JLabel("sample label");


Composite composite = new Composite(shell, SWT.EMBEDDED);

Frame frame = SWT_AWT.new_Frame(composite);

frame.setLayout(new BorderLayout());

frame.add(label,BorderLayout.CENTER);