简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM