0
votes

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.

1
It is described right there in the article you linked to: Composite composite = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND); Frame frame = SWT_AWT.new_Frame(composite); - Rüdiger Herrmann
No. it is quiet possible to use swing over Jface/swt dialog. It is a very bad idea to use Swing over swt /jface dialogue as certain limitations are there. eclipse.org/articles/… - Ardeshana Milan
@RüdigerHerrmann, note that parent in your example is Composite not a Dialog... - Asakura
@ArdeshanaMilan, you answer 'no' and 'it is quiet possible to use swing over dialog' at the same moment, so what is your answer finally? - Asakura

1 Answers

2
votes

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.