Problem with SWT_AWT [message #436081] |
Tue, 11 May 2004 09:40 |
Eclipse User |
|
|
|
Originally posted by: "prenom.,nom".sextant.thomson-csf.com
Hi,
I embedded two Swing panels in an SWT_AWT Frame, but when I open the parent
shell, there's nothing into it. There's just the shell with its title. I tried
to do the same as the snippet.
Here's a part of my code:
Shell shell = new Shell(new Display(), SWT.DIALOG_TRIM);
Composite prefComposite = new Composite(shell, SWT.EMBEDDED);
Frame embeddedFrame = SWT_AWT.new_Frame(prefComposite);
.........
embeddedFrame.setLayout(new BorderLayout());
.... // operations for the panels
embeddedFrame.add(pnlPrincipal, BorderLayout.CENTER);
embeddedFrame.add(pnlDisplay, BorderLayout.SOUTH);
.........
shell.open();
while(!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
What can be the problem? Did I forget something? Is it a problem of layout? Does
the shell need a layout too?
Thank you in advance
Fabrice
|
|
|
|
Re: Problem with SWT_AWT [message #436084 is a reply to message #436082] |
Tue, 11 May 2004 11:07 |
Eclipse User |
|
|
|
Originally posted by: "prenom.,nom".sextant.thomson-csf.com
Yes I tried to put a JPanel with a BorderLayout, but the result is the same. Did
you have a similar problem?
Henning Rogge a écrit :
>
> NOM Prenom wrote:
>
> > Hi,
> >
> > I embedded two Swing panels in an SWT_AWT Frame, but when I open the parent
> > shell, there's nothing into it. There's just the shell with its title. I tried
> > to do the same as the snippet.
> >
> > Here's a part of my code:
> >
> > Shell shell = new Shell(new Display(), SWT.DIALOG_TRIM);
> > Composite prefComposite = new Composite(shell, SWT.EMBEDDED);
> > Frame embeddedFrame = SWT_AWT.new_Frame(prefComposite);
> > .........
> >
> > embeddedFrame.setLayout(new BorderLayout());
> > .... // operations for the panels
> > embeddedFrame.add(pnlPrincipal, BorderLayout.CENTER);
> > embeddedFrame.add(pnlDisplay, BorderLayout.SOUTH);
>
> Have you tried to put a JPanel into the embedded Frame instead of using
> it directly ?
>
> Henning Rogge.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02766 seconds