Asakura
Asakura

Reputation: 127

JFace Dialog with Swing component

Is there a way to add Swing (javax.swing.*) component in Dialog (org.eclipse.jface.dialogs.Dialog) ?

I tried doing it with SWT/AWT Bridge but since parent in Composite constructor must be also Composite it seems to me to be impossible. Am I right? Or is there any other way to do that?

If yes, I would be very grateful for an working example.

Upvotes: 0

Views: 404

Answers (1)

SomeDude
SomeDude

Reputation: 14228

You can create a composite inside your dialog and use that composite to build your swing component inside it. inside your createDialogArea(Composite parent) method of your jface dialog:

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

( It needs to be SWT.EMBEDDED ) use this composite to build your frame :

Frame frame = SWT_AWT.new_Frame(composite);

Use the frame to build swing components.

Upvotes: 2

Related Questions