Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Problem with SWT_AWT
Problem with SWT_AWT [message #436081] Tue, 11 May 2004 09:40 Go to next message
Eclipse UserFriend
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 #436082 is a reply to message #436081] Tue, 11 May 2004 09:49 Go to previous messageGo to next message
Henning Rogge is currently offline Henning RoggeFriend
Messages: 148
Registered: July 2009
Senior Member
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.
Re: Problem with SWT_AWT [message #436084 is a reply to message #436082] Tue, 11 May 2004 11:07 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Problem with SWT_AWT [message #436092 is a reply to message #436084] Tue, 11 May 2004 13:57 Go to previous message
Henning Rogge is currently offline Henning RoggeFriend
Messages: 148
Registered: July 2009
Senior Member
NOM Prenom wrote:

> Yes I tried to put a JPanel with a BorderLayout, but the result is the same. Did
> you have a similar problem?

I had similar problems, some of them because I used no JPanel between
the Frame and my JTextPane, another one because I used a scrollable SWT
component as the parent of the EMBEDDED composite...

I posted a class called "ScrollableSwingComponent" some time ago, maybe
it can help you. Search for the thread "[SWT_AWT] Scrollable embedded
Swing Panel in SWT (solved)".

Henning Rogge
Previous Topic:A question about display
Next Topic:Handling of SelectionChanging-Event on a TabFolder causes freeze of Mouse and Keyboard Events
Goto Forum:
  


Current Time: Sat Apr 27 02:43:03 GMT 2024

Powered by FUDForum. Page generated in 0.02766 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top